Saturday, September 25, 2010

1.5.5.8 weekly release

A new weekly version is out now.

After a long delay it is now possible to debug elena vm clients. IDE Project settings were changed. There are three debug modes: disabled, enabled and enabled in vm. To debug vm client the third option should be selected.

The work on upndown, dtcalculator and eldoc samples continues.

I finally fixed the problem with helloworld sample (#00053) (it is shame that it took so many time to find out that I forgot to change the method name from 'do' to 'evaluate').

New symbols: sys'dates'today (theoretically it should return only date without time), ext'patterns'printingln (will print the line and moves the cursor to the new line).

I modified textfile reader implementation. The reader no longer returns trailing %r%n characters.

New methods:
std'patterns'indexenum search'run &from
(e.g ctrl'indexenum search'run &from:a@3 &value:b
- compare with ctrl'indexenum search'run &for:a &value:b)

sts'basic'literalindexer literalinfo'create &till
(e.g a@i literalinfo'create &till:a@j
- compare with a@i literalinfo'create &length:(j - i))

Monday, September 20, 2010

ELENA Programming Language: Object model


ELENA is a general-purpose, object-oriented, polymorphic language with late binding. It features multiple dispatching, context-dependent roles, dynamic inheritance and group object support.


The language treats any program as a set of objects (class instances). The program flow is a process of interaction between objects by sending each other messages. A message may have attached information (a message parameter). An object may react on message if it has an appropriate message handler (a method). If the object reacts on the message it is treated as successful otherwise unsuccessful. In its turn the method may send messages to other objects and so on until the flow reaches the method written by external tools (meta method). If the message is unsuccessful the flow is considered to be broken. It's possible to declare alternative flow which are executed if previous ones are broken. The method has only one input parameter and one output parameter (if the method returns itself it may be considered as an input one).
Every object may be formed up with other objects characterizing its internal state. They in turn may be formed with others and so on until meta objects which internal states are considered as raw data.
All referring entities in the language are objects. A variable is a reference to the object allocated in the program heap. The literal and numeric constants are references to the objects allocated in the static memory.


Any object is an instance of one or another class. The classes form the hierarchy tree on the principle of inheritance. There is the common super class - Object. The class parent may be explicitly declared. When the parent is not specified, the class inherits Object.


A class is an abstract concept which means that no operations can be done with it except a declaration. So to create the object its symbol should be referenced. There are explicit and implicit, static and dynamic symbols.
When a new class is declared simultaneously the appropriate implicit symbol is declared as well. The explicit symbol should be declared explicitly. In general the implicit symbol is the object in the initial state and the explicit one is the object in the particular state.
A static symbol is the class instance which state is preserved. A static symbol is always explicit one. There could be only one instance of static symbol.
The class declaration can be named or unnamed (inline declaration) public or private (when the class name is a private name). Its body contains member declarations: fields, roles and methods.


The fields can be accessed only within the class and its descendants. They can be a normal ones (references to another objects) or meta ones (raw data).
The roles are alternative sets of methods which could be used to implement context-dependent object behavior. When it is applied the role overrides the appropriate object methods with its own ones (static mutation).


Methods maybe private or public depending on their name (public or private). All class methods are considered to be polymorphic. It is possible to dispatch the method call depending on its parameter (declarative multi-dispatching). The method has only one input (or nil) and output (or it should return itself) parameters. If the method requires several parameters a special proxy argument list object can be used.


It is possible to declare a special "Any" handler. It is a method which redirects any unhandled message (i.e. messages which are not mapped in the class or its base classes) to the specified target. The target could be a single object (actually mutation) or collection (group object). A group object is a collection of the objects accessible through the common instance reference. The content of the group can be changed dynamically during the object life time (self-modification). The member objects can be a part of different groups or be single. The group can be persistent or temporally created to solve the particular task. The group objects are treated like "normal" ones and no special routines are required to work with them. If two or more members have duplicate methods either the first message mapping is resolved (exclusive mode) or all duplicate methods are executed (broadcast mode) depending on the group type.

Sunday, September 19, 2010

1.5,5,7 weekly release

Several new symbols were added to ELENA API:
sys'io: BinaryFile, NewBinaryFile
ext'text: HexAdapter, EIntFormatter, ELiteralFormatter

BinaryFile and NewBinaryFile are adapters to work with binary files.

#var reader := BinaryFile::"file.dat" reader'get.
#var writer := NewBinaryFile::"newfile.dat" writer'get.

Returned reader and writer support basic reader / writer protocol to work with data.

HexAdapter will allow to convert hexadecimal literal constant to the integer and back:
#var S := ext'text'HexAdapter literal'of:2Dh. // -> "2D"
#var N := ext'text'HexAdapter int'of:S. // -> 2D

The work on upndown example continues. It is now possible to play basic rounds (without joker).

New binary corex.bin will contain an enhanced GC implementation supporting multi-threading.

Some settings were moved from elc.cfg to the specific templates (like console.cfg)

On the next week I will start a debugger redesign (to support elenavm client debugging), continue slow migration to Linux and a lot of other things.

I'm planning to start my first real open architecture application - opencalc.

So that's all for this week

Tuesday, September 7, 2010

ELENA Programming Language: Paradigm

As a general purpose programming language ELENA is able to support various programming paradigms. But there is a special one the language was made for: open architecture paradigm (OA).
OA paradigm presumes that the system consists of the number of relative simple objects actively interacting with each other and forming object groups. The content of the group can be modified (self-modified) depending on its state or functionality. Typical group consists of several members representing different implementation layers. Let's presumes that we develop the card game. The main system actors will be: a game master, a player and a representer. We could define several layers: basic, game logic and multiplayer ones. A basic layer will implement the common functionality which will be used in any game. A game logic layer will care about implementing the game rules and a multiplayer one will support a chosen transport protocol. Additional layers can be applied to any game actors, like AI one for the player. Testing environment can also modify the system to set up some test scenario and so on. A group content will be modified to be more suitable for the current game stage (for example a computer player may change it content for implementing different strategies, if the game has different stages the game master will be self-modified to lead the appropriate game stage). At the game start the main groups will be self-assembled depending on the user choice.
In general OA paradigm tends to change the accent from a vertical inheritance to a horizontal one. It will make the program implementation more decentralized, limiting the number of "super" objects. The main advantage of this approach is the possibility to extend / modify system more easily, sometimes even without need to recompile it.

Friday, September 3, 2010

1.5,5,4 weekly release

A new version is available - 1.5.5.4

It contains mostly ELENA API bug fixes and a new symbol - gui'dialogs'errorbox

Thursday, September 2, 2010

Method calling in ELENA: overhaul, part 2

First of all, I would like to announce changes in the project release practice. Now there will be two types of releases: official and weekly ones. Official release will happens once per several months (version number x.x.x) as it was before. But additionally every several week I will publish weekly release (version numbers x.x.x.x) and they will be located in http://sourceforge.net/projects/elenalang/files/ELENA/Weekly.

The first such weekly release happened yesterday - http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/elena-1.5.5.3.zip/download
The main purpose of that release was publishing the changes in method call syntax. Apart from this I did several small enhancements. First of all I decided to get rid of message subject prefix "gui". Though it is still possible to use it in most cases now it is recommended to omit it. So the old style code like this - self set &gui'location'x:50 &y:50 set &gui'size'width:700 &height:520 gui'control'caption'set:"Caption" - will look a bit better -
self location'set &x:50 &y:50 size'set &width:700 &height:520 control'caption'set: "Caption".
The same for event handler - on'control'Click'do has to be converted to on'Click'do.

Here the list of changes:
  • LiteralType and ArrayType "create" methods are now obsolete. LiteralType literalinfo'create &length and ArrayType arrayinfo &count should be used instead. If you wish to initialize the array during its creation you should use the same method - basic'ArrayType arrayinfo'create &count:10 &action: => (basic'Integer <<0)
  • ctrl'IndexEnum run &enum'in &action and ctrl'Enum run &enum'in &action are no longer supported - ctrl'IndexEnum pattern'run&for &action and ctrl'Enum pattern'run&for &action should be used instead.
  • gui'control'items'get => control'items'get
  • Event handlers "on'control'Paint'do" and " control'IndexChanged'do " should be converted into - on'Paint &canvas and on'IndecChanged &index
  • ext'patterns'ArrayType is no longer supported. Use std'basic'ArrayType instead
  • ext'io'textfile and ext'io' LogTextFile are no longer supported. They were moved into sys package. So use sys'io'textfile and sys'io' LogTextFile
  • std'patterns'Loop is refactored. Repeater pattern'run &for &action should be used instead
The old style syntax will be kept until 1.5.6 release. If you have any questions or problems with converting feel free to ask.