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
236 stars 26 forks source link

support typeof attribute #540

Closed arakov closed 3 years ago

arakov commented 3 years ago

Make possible to get a type of a variable in compile-time to be used in new expression:

new typeof a

It will be used in number of code templates e.g. .! - allocate and send

arakov commented 3 years ago

A new attribute is introduced:

A;

public program()
{
    A a;

    a := new __typeof a();
}

__typeof attribute returns the type of the variable at run-time

arakov commented 3 years ago

done