Giter Site home page Giter Site logo

Add support for Object Literals about somns HOT 4 CLOSED

smarr avatar smarr commented on May 18, 2024
Add support for Object Literals

from somns.

Comments (4)

smarr avatar smarr commented on May 18, 2024

This task is likely going to be worked on by richard-roberts for Grace support.

from somns.

 avatar commented on May 18, 2024

Thanks for the initial thoughts here @smarr. In the example you provide above, I am not clear on whether the println method is an instance method of obj (the outer object literal) or the inner nested class.

As per the following example, my interpretation is that println is to be an instance method belonging to the outer object literal (and that the inner nest class is declared simply to show that it is possible to nest classes in object literals). Is this correct?

  obj := 
    (* Object literal initializer *)
    (
      | 
        public field = local.
      | 
      local println.
    )

    (* Object literal body *)
    (
      (* A class nested into the object literal's body *)
      public class <superclass identifier>()()

      (* An instance method of the object literal *)
      public println = ( field println. local := local + 1. ).
    )

from somns.

smarr avatar smarr commented on May 18, 2024

I updated my initial example, reformated it, and added a missing closing parenthesis.
The idea was that println is a method of the object literal defined, which changes the count of local, which is visible is the subsequent println.
So, it was supposed to be as you showed in your example, indeed.
(I also gave the inner class a name and fixed its definition.)

from somns.

smarr avatar smarr commented on May 18, 2024

Implemented with #112.

from somns.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.