ELENA-LANG / elena-lang

ELENA is a general-purpose language with late binding. It is multi-paradigm, combining features of functional and object-oriented programming. Rich set of tools are provided to deal with message dispatching : multi-methods, message qualifying, generic message handlers, run-time interfaces
https://elena-lang.github.io/
MIT License
227 stars 23 forks source link

Accessing a variable declared in the upper scope #638

Closed arakov closed 3 months ago

arakov commented 3 months ago

If two variables are declared in different scopes they can have the same name.

There has to be a way to refer a variable declared in the upper scope:

  var a := new List();
  {
     var a := 2;

     super a.append(a); 
  };

  console.printLine(a.asEnumerable());

The proposed syntax can be used for script grammar (see xforms).

arakov commented 3 months ago

Done in ELENA 6.0.8