by Alex Rakov
General-purpose, pure object-oriented language with late binding.

ELENA is a general-purpose, object-oriented, polymorphic language with late binding. It features message dispatching / manipulation, dynamic object mutation, a script engine / interpreter and group object support.

Any program or library consists of modules containing classes and symbols.

The main way to interact with objects in ELENA is sending a message. The message name is structured and consists of a verb, a signature and a parameter counter. The verb defines a message action, for example read or write some data. There are only limited set of possible verbs. The signature is user defined and describes the message parameters. If the signature is not provided the message is considered to be generic and can be qualified (by dispatching).

If the object wants to handle the message it has to contain the method with the same name. If no method mapping was found the flow is considered to be broken and the control goes to the next alternative flow (exception handler) or the program is stopped. It is possible to declare generic handler which will be called for all incoming messages.

A class encapsulates data (fields) with code (methods) to access it. It is not possible to get a direct access to the class content.

To work with the class we have to create its instance with the help of the special methods - constructors.

There are special type of classes which do not have fields and constructors and can be used directly (extensions / symbols).

Classes form the inheritance tree. There is the common super class - system'Object. ELENA does not support multiple inheritance, though it is possible to inherit the code using redirect handler (so called "horizontal inheritance"). When the parent is not provided the class inherits directly system'Object.

#define system.
#define system'math.
#define system'routines.
#define extensions.

// --- Program --- 

#symbol Program = 
    // reading    
    #var aNumber := console write:"Enter the number you want to convert: " readLine:(Integer new).
    // converting
    #var aBinaryStr := aNumber toLiteral &base:2.

    // printing
        writeLine:"A binary presentation of the number : ":(aBinaryStr padLeft &char:#48 &length:((aBinaryStr length / 4 + 1) * 4))
        writeLine:"Press any key to continue".

    // waiting for any key
    console readChar.
Information updated 08/02/15
View Comments