<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6612268259362701123</id><updated>2012-02-22T05:11:19.014-08:00</updated><category term='object oriented programming'/><category term='elena virtual machine'/><category term='elena programming language'/><category term='what&apos;s new'/><category term='elena y project'/><category term='self assembly'/><category term='elena sample code'/><category term='object oriented'/><category term='programming'/><category term='tutorial'/><category term='elena programng language'/><category term='new programming language release'/><category term='dynamic programming'/><category term='multi dispatching'/><category term='elenavm'/><category term='new programming language'/><category term='elena rosseta code'/><category term='group object'/><category term='know how'/><title type='text'>ELENA Programming Language blog</title><subtitle type='html'>ELENA is a new non-mainstream general-purpose, pure object-oriented language with late binding. This blog will follow its development</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>48</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6869896005368159081</id><published>2012-02-01T03:54:00.001-08:00</published><updated>2012-02-16T08:20:11.190-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dynamic programming'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Dynamic Programming in ELENA</title><content type='html'>&lt;p style="text-align: justify;"&gt;Last year I demonstrated how to create BF interpreter without writing any program. But to implement a loop I still had to create a new class (in runtime). After a while I realize that it is possible to get rid of auto code generation completely, using only special group types (except for dynamic subjects).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Let's start with general overview of dynamic programming paradigm in ELENA. Instead of writing a code (with the help of run-time compilation or some built-in functionality) we could build (assemble) a new object reusing existing functionality. Subjects and built-in verb roles will allow us to create new methods and invoke them (without any kind of reflection mechanisms), different group objects (wrap, echo, cast, prop and action) will combine them to implement the program logic.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Presume we would like to create a dynamic code which will execute the following bf code: , [ . , ]&lt;/p&gt;&lt;p style="text-align: justify;"&gt;First of all we have to create a tape:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anIndexer := factory'NewArray::{ &amp;factory'array_size:1024 &amp;factory'pattern:(WideCharVar::0) } @ 0.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Now we have to add a new dynamic method to the indexer which executes the loop until the current item is zero. So we create a group and add the indexer into it:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var aGroup := sys'dynamics'GroupVariable append &amp;sys'dynamics'group_member: anIndexer&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Our dynamic method will need its own subject:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#subject bfloop.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Let's create the method:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;aGroup append &amp;sys'dynamics'group_member:__prop(bfloop, __run, __wrap(EWhileNotZero, aGroup)).&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;In this code we use two types of group objects:__prop and __wrap. __prop is a property collection which consists of a subject symbol (bfloop), a wrapper (verb external role) and a content - another wrapper. The property converts a qualified message (bfloop'invoke) into a generic one (invoke) and sends it to a verb role. A verb role in its turn sends the appropriate message (run) to the property content (__wrap(EWhileNotZero, aGroup)). The created group is equivalent to the following code:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;aGroup append &amp;sys'dynamics'group_member: { bfloop'invoke : anAction = self~EWhileNotZero run:anAction. }.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;To implement input / output operations we will use the following actions:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anOutputAction := __wrap(__write, 'program'output).&lt;br /&gt;#var anInputAction := __wrap(__save, __action(__get, 'program'input, nil)).&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;The "traditional" code looks like this:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anOutputAction :={ invoke : aGroup =  'program'output write:aGroup. }.&lt;br /&gt;#var anInputAction :={ invoke : aGroup =  'program'input get save:aGroup. }.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note that once again we use verb roles to translate invoke into write and save respectively. anInputAction is a bit more complicated. We need to implement the action before invoking save message. That's why another special group - __action - is used.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;And finally we combine these actions:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;__cast(anInputAction, __echo(bfloop, __wrap(__eval, __cast(anOutputAction, anInputAction)))) invoke:aGroup.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Which could be translated into the following code:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;__cast(anInputAction, { invoke : aGroup =  aGroup invoke &amp;bfloop:__cast(anOutputAction, anInputAction) }) invoke:aGroup.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;As you can see we were able to create an object with a custom method without actually declaring a new class. Of course this approach is not suited for programmers but it could be used for automatic code assembling inside the program in run-time, for example in ELENAVM script:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;tape       =&gt;&lt;br /&gt;              // 1: append&lt;br /&gt;              &amp;subject &lt;br /&gt;              // 2: goto&lt;br /&gt;              &amp;subject&lt;br /&gt;              // 3: loop&lt;br /&gt;              &amp;subject&lt;br /&gt;              // 4: inc action&lt;br /&gt;              &amp;1 1 &amp;echo&lt;br /&gt;              // 5: dec action&lt;br /&gt;              &amp;1 -1 &amp;echo&lt;br /&gt;              // 6: next action&lt;br /&gt;              &amp;2 1 &amp;echo&lt;br /&gt;              // 7: prev action&lt;br /&gt;              &amp;2 -1 &amp;echo&lt;br /&gt;              // 8: output action&lt;br /&gt;              &amp;__write &amp;nil 'program'output &amp;wrap&lt;br /&gt;              // 9: group&lt;br /&gt;              &amp;nil&lt;br /&gt;              sys'dynamics'groupvariable&lt;br /&gt;              &amp;std'basic'factory'array_size &amp;sys'vm'routines'egetprop 1024 &amp;prop&lt;br /&gt;              &amp;std'basic'factory'pattern &amp;sys'vm'routines'egetprop 0 std'basic'widecharvar &amp;prop&lt;br /&gt;              &amp;union2&lt;br /&gt;              std'basic'factory'patternarrayfactory&lt;br /&gt;              std'basic'factory'newarray &lt;br /&gt;              0 ^refer &lt;br /&gt;              ~ sys'dynamics'group_member ^append&lt;br /&gt;              // :: append method&lt;br /&gt;              &amp;1 &amp;__append &amp;9 &amp;prop&lt;br /&gt;              ~ sys'dynamics'group_member ^append&lt;br /&gt;              // :: goto method&lt;br /&gt;              &amp;2 &amp;__append &amp;std'dictionary'index &amp;9 &amp;wrap &amp;prop&lt;br /&gt;              ~ sys'dynamics'group_member ^append&lt;br /&gt;              // :: loop method&lt;br /&gt;              &amp;3 &amp;__run &amp;std'patterns'ewhilenotzero &amp;9 &amp;wrap &amp;prop&lt;br /&gt;              ~ sys'dynamics'group_member ^append&lt;br /&gt;              // 10: in action&lt;br /&gt;              &amp;__save &amp;__get &amp;nil 'program'input &amp;nil &amp;action &amp;wrap&lt;br /&gt;              // build command batch&lt;br /&gt;              &amp;cast&lt;br /&gt;              $body&lt;br /&gt;              &amp;9&lt;br /&gt;              ^ invoke;&lt;br /&gt;inc        =&gt; &amp;4 |= $body;&lt;br /&gt;dec        =&gt; &amp;5 |= $body;&lt;br /&gt;next       =&gt; &amp;6 |= $body;&lt;br /&gt;prev       =&gt; &amp;7 |= $body;&lt;br /&gt;out        =&gt; &amp;8 |= $body;&lt;br /&gt;in         =&gt; &amp;10 |= $body;&lt;br /&gt;while      =&gt; &amp;3 &amp;__eval &amp;cast $body &amp;wrap &amp;echo |=;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6869896005368159081?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6869896005368159081/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2012/02/dynamic-programming-in-elena.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6869896005368159081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6869896005368159081'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2012/02/dynamic-programming-in-elena.html' title='Dynamic Programming in ELENA'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-9121407289088164619</id><published>2012-01-05T03:10:00.000-08:00</published><updated>2012-02-16T08:20:54.567-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dynamic programming'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>New Group Types</title><content type='html'>&lt;p style="text-align: justify;"&gt;The latest 1.6.12 release contains several critical changes in the way how the language works with group objects and subjects. In this article I will cover some of these changes.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;First of all I made several cosmetic changes: the class extension keywords - #annex and #union were renamed to #join and #outer respectively. Group keywords #group, #union and #cast are no longer supported, built-in classes should be used instead. And a generic handler (#generic) was added.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Detailed discussion we will start with class extensions: #join expression. #join extension can be used both inside the class declaration and as a part of the inline (nested) class expression.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyClass&lt;br /&gt;{&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;    #join EMyExtension.&lt;br /&gt;}&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;If the keyword is followed by an external role (or a stateless class) it is used for "horizontal" inheritance. It is roughly similar to the multiply interface inheritance (note that the class "parents" should not have their own fields).&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyIndexer&lt;br /&gt;{&lt;br /&gt;    #field theItem.&lt;br /&gt;&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;    #join theItem.&lt;br /&gt;}&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;But the joining expression can be a normal object (e.g class field) as well. In this case it is similar to the group object and is used for run-time extension (permanent dynamic mutation). For example it is used in ELENA indexers to extend the collection item with navigating functionality. Note that in both cases "self" built-in variable refers to the extended class instance (so it is similar to a group object).&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;'program'output &lt;&lt; #join(anObject) { literal = "object:" + anObject literal. }.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;In this case the inline class declaration can be used as well.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Now let's go to #outer (join) extension.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class Variable&lt;br /&gt;{&lt;br /&gt;    #field theValue.&lt;br /&gt;&lt;br /&gt;    #method content = theValue.&lt;br /&gt;&lt;br /&gt;    #method content'set : aValue&lt;br /&gt;    [&lt;br /&gt;        theValue := aValue.&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;    #outer theValue.&lt;br /&gt;}&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Outer join extension can be used only inside the class declaration and in most cases is used with objects. The main difference with join extension is that "self" variable is not overridden. This type of extension is used mostly in containers (a dynamic variable).&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyClass&lt;br /&gt;{&lt;br /&gt;    ...&lt;br /&gt;&lt;br /&gt;    #generic&lt;br /&gt;    [&lt;br /&gt;        'program'output &lt;&lt; "My class does not support this method".&lt;br /&gt;        $self fail.&lt;br /&gt;    ]&lt;br /&gt;}&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;#generic extension is a special method which is called for any unhandled message.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Now let's go to the main topic of this article: group objects. We will start an implicit group object. Before I will continue let me remind you what is ELENA group object: a collection of the objects accessible through the common instance reference (&lt;a href="http://elenalang.blogspot.com/2010/07/let-us-define-group-object-as.html"&gt;see here&lt;/a&gt;).&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var aSecond := aList~EItem @ 1.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;A group object is used to dynamically extend the existing object with a new functionality (some kind of mutation). For example in this case we extends the collection with an ability to return the collection member by index. A group can be temporal if the group is immediately followed by a message and the mutator is an external role or a stateless class.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;The group can be created explicitly with a help of built-in class - __group.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anExtendedList := __group(EItem, aList).&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note that in this case the group is always permanent.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Another way to temporal extend the object is a wrap group (__wrap built-in class)&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var aStr := WideStrValue::__wrap(EInt32Variant, aNumber).&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;A wrap is a special group which uses the first member of the collection as a wrapper around the second one (content). It means that only the wrapper methods are invoked but "self" variable is assigned to the wrap content. In most cases the wrapper object should be a role or a stateless class. Note that a wrap should have only two members.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Before we will continue with other group types, let me say a few words about subjects. As you may probably know in ELENA language the message consists of message subject (actually a message namespace) and a message verb (built in list of names such as get, set, add, append and so on). A subject should be declared before use. Simultaneously a special symbol (named expression) with the same name is declared. Due to this the program could handle a subject like any other program element (without any kind reflection).&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var aProp1 := aObject subject'get.&lt;br /&gt;#var aProp2 := anObject~subject get.&lt;br /&gt;#var aSubj := subject. #var aProp3 := __wrap(aSubj, anObject) get.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Both these expressions are equivalent but in the third case actually a variable referring to the subject symbol is used.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;A special case of the wrap group is a property collection (__prop built-in class)&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Compare these two equivalent expressions:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class egetadapter&lt;br /&gt;{&lt;br /&gt;    #method get = self.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#var anArray1 := NewArray::{ &amp;array_size:1024 }.&lt;br /&gt;&lt;br /&gt;#var anArray2 := NewArray::__prop(array_size, egetadapter, 1024).&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;The property collection consists of a subject symbol, a wrapper and a content. When a message is sent to the collection the property handler checks its subject and if it is equal to the property subjects the generic message (only the message verb) is sent to the wrapper with "self" variable assigned to the wrap content. As you may see the property collection is similar to the "traditional" class property. Note that in this case no new class is declared and the subject could be dynamic.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;And our final group type is a union (__union). Union (similar to outer class extension) could be considered as a collection of dynamic variables.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anArray1 := NewArray::{ &amp;array_size:1024 &amp;pattern:integer::0 }.&lt;br /&gt;&lt;br /&gt;#var anArray2 := NewArray::__union(__prop(array_size, egetadapter, 1024), __prop(pattern, egetadapter, integer::0)).&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-9121407289088164619?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/9121407289088164619/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2012/01/new-group-types.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/9121407289088164619'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/9121407289088164619'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2012/01/new-group-types.html' title='New Group Types'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-815468745861644593</id><published>2011-11-08T04:27:00.000-08:00</published><updated>2012-02-16T08:22:06.247-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='what&apos;s new'/><title type='text'>What's new in 1.6.6</title><content type='html'>&lt;p style="text-align: justify;"&gt;In this post I would like to discuss some things done in 1.6.6. The migration of ELENA code base to LIB2 (and simultaneously to GCX ) was finally completed. Up'N'Down sample (the most complicated program written in ELENA so far) is now playable again. As a result I was able to continue work on ELENA library. So I would like to present two new classes (actually external roles) introduced in 1.6.6: std'patterns'esort and std'routines'estrop.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;First of all I have to remind some basic things about roles and groups. A role is an alternative set of methods which can be used for context-dependant programming. The role cannot have fields so it could be considered as stateless class. There are two types of roles: internal and external ones.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;A group is a collection of objects sharing the common instance variable (self). The group is used for dynamic code extending. We could consider it either as a JIT (just in time) inheritance or as a code mutation. For example if I would like to add or override the object method I could extend it by creating a group with my custom object containing the required code. The given group will be practically identical to the original object and could be used instead of it.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So if we would like to apply the role to the object we could actually group them. For internal role it is done with a help of #shift &lt;role_name&gt; statement. For external we should declare the group ourselves with tilde operator (in reality it is a bit more complicated but I will simplify for the sake of clarity).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So far so good. Now let's turn to our new classes (roles). std'patterns'ESort is used to extend any collection / array with sorting functionality. Here some examples how it could be used:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var a := (1,7,4,-5).&lt;br /&gt;a~esort run: aPair =&gt; (aPair former &lt; aPair later).&lt;br /&gt;&lt;br /&gt;#var b := ("b","ab","a","aa").&lt;br /&gt;b~esort run: aPair =&gt; (aPair former &lt; aPair later).&lt;br /&gt;&lt;br /&gt;#var c := list += 3 += -4 += 1.&lt;br /&gt;c~eindexeditem~esort run: aPair =&gt; (aPair former &lt; aPair later).&lt;br /&gt;&lt;br /&gt;#var d := list += "b" += "av" += "a".&lt;br /&gt;d~eindexeditem~esort run: aPair =&gt; (aPair former &lt; aPair later).&lt;br /&gt;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note that std'routines'EIndexedItem extends any collection with "@" operator (used for array-like access to its members). Run method sorts the collection basing on the provided expression.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Our another role - std'routines'EStrOp extends the literal value with some basic string operations like find, insert, delete and substring.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var p1 := "abba"~estrop find &amp;first:"b".&lt;br /&gt;#var p2 := "abba"~estrop find &amp;last:"a".&lt;br /&gt;&lt;br /&gt;#var s2 := "abba"~estrop replace &amp;from:"b" &amp;to:"B".&lt;br /&gt;#var s3 := "abba"~estrop replace_all &amp;from:"b" &amp;to:"B".&lt;br /&gt;#var s4 := "abba"~estrop substring &amp;from:1 &amp;to:2.&lt;br /&gt;&lt;br /&gt;#var s41 := "abba"~estrop substring &amp;from:1 &amp;length:2.&lt;br /&gt;&lt;br /&gt;#var s5 := "aa"~estrop insert &amp;literal:"bb" &amp;index:1.&lt;br /&gt;#var s6 := "abbba"~estrop delete &amp;from:2 &amp;to:2.&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-815468745861644593?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/815468745861644593/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/11/whats-new-in-166.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/815468745861644593'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/815468745861644593'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/11/whats-new-in-166.html' title='What&apos;s new in 1.6.6'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6645396417178997385</id><published>2011-10-03T01:57:00.001-07:00</published><updated>2012-02-16T08:21:34.349-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='know how'/><title type='text'>ELENA Engine: Sections, references</title><content type='html'>&lt;p style="text-align: justify;"&gt;When I started developing my language I was interested in creating a compiler from scratch without looking into other implementations. So some of my solutions may look unorthodox. Nevertheless the linker is the most "old" part of my code. Once made that decision I stuck with it.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Any compiler may be split into several parts: a parser, a code compiler and a linker. In general a parser parses the source code, a compiler generates the output code and a linker assembles this code into executable file. From the linker point of view the program code consists of sections connected with each other by references. The section may contain both an executable code and data. The output sections usually are saved into temporal files, which we could call compiled modules (or simply modules).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;In ELENA the situation is a bit more complex. The modules may contain native executable code (in this case this module is called "primitive" and generated by external tools, for example asm2binx) and ELENA byte codes (ecodes). So ecodes should be converted into native codes with a help of Just In Time Compiler (JITCompiler &amp; JITLinker in ELENA Engine). It could be done in the compiler (elc) itself or in a virtual machine (elenavm) right after the module is loaded (hence the name - just in time compiler).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Now let's discuss ELENA compiled module (.NL file). We could consider the module as a list of data (sections, messages, constants). To help the linker find the required data, every list item has a unique (within its module) identifier - a reference. A reference is a 32bit integer, where the highest byte contains the reference type (see elenascr2\engine\elenaconst.h :: ReferenceType) and the rest is a reference number. The reference number has a corresponded literal identifier in the module reference table - reference name. The reference name consists of module and proper names. If the module name equals to the name of the current one it is the reference to this module, otherwise it is external one.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;The code and data are saved into sections. Depending on the reference type the section may contain native code, data, VM byte codes, VMTs. In most cases the section has references to other part of the program or library. To support these external references every section is followed by a relocation table. The relocation table has quite simple structure: it is list of reference id and the address of the reference location in the section (relative to the section).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;The module may contain messages (actually message qualifier - subjects) and constants. Every time a new subject is declared its name is saved in the message table and the appropriate reference is used inside the code. With the help of relocation table these ids are synchronized between different modules. The same happens with constants (numeric and literal). This allows us to have only one instance for every constant used in the code.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So how the linker works? Every program has an entry (or several of them in case of VM). Presume it is "sys'entries'simple". The linker loads the module "sys'entries" and finds the appropriate reference number (based on the module reference table). To load the required data we need to know the reference type. Presume it is a symbol reference (byte code section). Combining the reference number and the type we could find the required section. The reference type tells the linker where this section should be copied to, in our case to .TEXT (executable code). If it is a byte code (as in our case) JITCompiler converts ecodes into the native commands. Next the linker will go through the relocation table and load all referred data (sections, external functions, messages, constants and so on) and update the section body with the correct addresses and so on.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;And finally I will provide the structure of .NL file:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;ELENA module structure&lt;br /&gt;-------------------------&lt;br /&gt;a) General file structure:&lt;br /&gt;+--------------+&lt;br /&gt;| module stamp |&lt;br /&gt;+--------------+&lt;br /&gt;| module name  |&lt;br /&gt;+--------------+&lt;br /&gt;|  references  |&lt;br /&gt;+--------------+&lt;br /&gt;|   messages   |&lt;br /&gt;+--------------+&lt;br /&gt;|  constants   |&lt;br /&gt;+--------------+&lt;br /&gt;|   sections   |&lt;br /&gt;+--------------+&lt;br /&gt;&lt;br /&gt;b) module stamp - fixed-size module version signature (not terminated by zero)&lt;br /&gt;&lt;br /&gt;c) module name  - zero terminated module name&lt;br /&gt;&lt;br /&gt;d) references   - reference section &lt;br /&gt;+--------------+&lt;br /&gt;|    size      |  total section size&lt;br /&gt;+--------------+ &lt;br /&gt;|   reference  |&lt;br /&gt;|     memory   |&lt;br /&gt;|  hash table  |&lt;br /&gt;&lt;br /&gt;e) messages&lt;br /&gt;+--------------+&lt;br /&gt;|    size      |  total section size&lt;br /&gt;+--------------+ &lt;br /&gt;|   message    |&lt;br /&gt;|   memory     |&lt;br /&gt;|  hash table  |&lt;br /&gt;&lt;br /&gt;f) constants&lt;br /&gt;+--------------+&lt;br /&gt;|    size      |  total section size&lt;br /&gt;+--------------+ &lt;br /&gt;|   constant   |&lt;br /&gt;|    memory    |&lt;br /&gt;|  hash table  |&lt;br /&gt;&lt;br /&gt;g) sections     - section list      &lt;br /&gt;&lt;br /&gt;&lt;total size&gt;                 &lt;br /&gt;{section}&lt;br /&gt;&lt;br /&gt;where section = &lt;br /&gt;&amp;lt;section id&amp;gt;&lt;br /&gt;&amp;lt;section size&amp;gt;&lt;br /&gt;&amp;lt;section body&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;relocation table size&amp;gt;&lt;br /&gt;&amp;lt;reference id&amp;gt;&lt;br /&gt;&amp;lt;reference position&amp;gt;&lt;br /&gt;...&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6645396417178997385?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6645396417178997385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/10/elena-engine-sections-references.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6645396417178997385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6645396417178997385'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/10/elena-engine-sections-references.html' title='ELENA Engine: Sections, references'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-598697241904602536</id><published>2011-09-20T02:55:00.000-07:00</published><updated>2012-02-16T08:22:41.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dynamic programming'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>ELENA Virtual Machine Script: BF interpreter</title><content type='html'>&lt;p style="text-align: justify;"&gt;&lt;a href="http://elenalang.blogspot.com/2011/06/elena-virtual-machine-script.html"&gt;In the previous post&lt;/a&gt; I showed some basic things about the terminal script. After several changes the current system of commands looks like this:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;-q  - quit&lt;/li&gt;&lt;li&gt;-h  - help&lt;/li&gt;&lt;li&gt;-ton - trace mode is on &lt;/li&gt;&lt;li&gt;-toff - trace mode is off &lt;/li&gt;&lt;li&gt;-l[path] - load a script from file &lt;/li&gt;&lt;li&gt;-n[path] - load an inline script from file &lt;/li&gt;&lt;li&gt;-c[path] - load DSA script from file &lt;/li&gt;&lt;li&gt;-i[inline script] - execute inline script\n"&lt;/li&gt;&lt;li&gt;-g[dsa rule] - define dsa rule; they should be separated by a semicolon except the last rule\n"&lt;/li&gt;&lt;li&gt;-pX - select parse mode (0 - standard, 1 - simple)&lt;/li&gt;&lt;/ul&gt;&lt;p style="text-align: justify;"&gt;Note that there are two parse modes: standard and simple. Presume we have to parse the following expression: "23 * 4". In Standard mode it will be parsed as three terminal symbols: "23", "*" and "4". But in simple mode every character will be a separate terminal symbol. This mode will be used in our BF interpreter.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Despite I called it interpreter it is actually just-in-time compiler. The script tape generated by ELENA Script Engine is translated into byte-codes and executed like "normal" code.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;The DSA script looks like this:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;statement  ::= next;&lt;br /&gt;statement  ::= next;&lt;br /&gt;statement  ::= prev;&lt;br /&gt;statement  ::= inc;&lt;br /&gt;statement  ::= dec;&lt;br /&gt;statement  ::= out;&lt;br /&gt;statement  ::= in;&lt;br /&gt;statement  ::= "[" while;&lt;br /&gt;statement  ::= idle;&lt;br /&gt;&lt;br /&gt;next       ::= "&gt;";&lt;br /&gt;prev       ::= "&lt;";&lt;br /&gt;inc        ::= "+";&lt;br /&gt;dec        ::= "-";&lt;br /&gt;out        ::= ".";&lt;br /&gt;in         ::= ",";&lt;br /&gt;idle       ::= $any;&lt;br /&gt;&lt;br /&gt;while      ::= statement while_r;&lt;br /&gt;&lt;br /&gt;while_r    ::= "]";&lt;br /&gt;while_r    ::= statement while_r;&lt;br /&gt;&lt;br /&gt;tape       ::= statement statements;&lt;br /&gt;&lt;br /&gt;statements ::= statement statements;&lt;br /&gt;statements ::= $eps;&lt;br /&gt;&lt;br /&gt;start      ::= tape;&lt;br /&gt;&lt;br /&gt;tape       =&gt;  &amp;union&lt;br /&gt;                  &amp;group 1024 += &amp;std'dictionary'count += *=&lt;br /&gt;                  &amp;group { 0 std'basic'widecharvar } += &amp;std'basic'factories'onnew += *=&lt;br /&gt;               std'basic'factories'newinitializedarray 0 ^refer $body;&lt;br /&gt;next       =&gt; 1 &amp;std'dictionary'index ^^append $body;&lt;br /&gt;prev       =&gt; 1 &amp;std'dictionary'index ^^reduce $body;&lt;br /&gt;inc        =&gt; 1 ^append $body;&lt;br /&gt;dec        =&gt; 1 ^reduce $body;&lt;br /&gt;out        =&gt; &amp;nil 'program'output &amp;previous ^write . $body;&lt;br /&gt;in         =&gt; &amp;nil 'program'input &amp;nil ^get ^write $body;&lt;br /&gt;&lt;br /&gt;while      =&gt; &amp;group&lt;br /&gt;                &amp;previous +=&lt;br /&gt;                &amp;std'patterns'ewhilenotzero +=&lt;br /&gt;                { $body } ^run .;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;As you may already know the script consists of two type of rules: grammar and DSA ones. Grammar rules allow us to generate a derivation tree and DSA ones are used to build the code (list of VM instructions, so-called a script tape) based on that tree. DSA rule is applied for the grammar one with the same name.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;I think grammar rules are quite simple so we begin with DSA ones. The first rule which is invoked right after the start is tape. In this rule we create an array of widechar objects. &lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;tape       =&gt;  &amp;union&lt;br /&gt;                  &amp;group 1024 += &amp;std'dictionary'count += *=&lt;br /&gt;                  &amp;group { 0 std'basic'widecharvar } += &amp;std'basic'factories'onnew += *=&lt;br /&gt;               std'basic'factories'newinitializedarray 0 ^refer $body;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;The equivalent ELENA code will look like this:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;std'basic'factories'newinitializedarray::&amp;count:1024 &lt;br /&gt;&amp;onnew: (=&gt; std'basic'widecharvar::0) @ 0&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note that { 0 std'basic'widecharvar } is an action symbol (compare with =&gt; std'basic'widecharvar::0 in ELENA code). To pass several parameters to newinitializedarray we use a union of group objects.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&amp;group 1024 += &amp;std'dictionary'count += *=&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;is in fact equivalent to &lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;{ count = 1024. }&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;where std'dictionary'count is a subject symbol, &amp;group is an instance of the $elean'group class and command += adds the object to the group.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;To understand how it works I will remind about subject symbols. Every time a new subject is declared the appropriate subject class is auto-generated as well. This class contains "subject'get" method returning self variable. A union is a week group type. It means that self variable points to the group member rather than to the group itself. So the following expression&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#union(#group(std'dictionary'count,1024),#group(std'basic'factories'onnew,...)) std'dictionary'count&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;will return a count group. As a result this union of groups is equvivalent to&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;{ std'dictionary'count = 1024. std'basic'factories'onnew = ... }&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Other rules are quite simple. For example rule next:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;next       =&gt; 1 &amp;std'dictionary'index ^^append $body;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;is similar to &lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;... index'append:1&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note that &amp;std'dictionary'index is a subject symbol used as multiple dispatcher: ^^ is equivalent to &amp;: operator.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;And finally let's consider the simple echo program:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-p1&lt;br /&gt;,[.,]&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;It will be translated into the following inline code:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;@new $elena'$union&lt;br /&gt;@new $elena'$group&lt;br /&gt;@push 1024&lt;br /&gt;@group-add&lt;br /&gt;@push std'dictionary'count&lt;br /&gt;@group-add&lt;br /&gt;@union-add&lt;br /&gt;@new $elena'$group&lt;br /&gt;@sub&lt;br /&gt;  @push 0&lt;br /&gt;  @call std'basic'widecharvar&lt;br /&gt;@end&lt;br /&gt;@group-add&lt;br /&gt;@push std'basic'factories'onnew&lt;br /&gt;@group-add&lt;br /&gt;@union-add&lt;br /&gt;@call std'basic'factories'newinitializedarray&lt;br /&gt;@push 0&lt;br /&gt;@send refer&lt;br /&gt;@push $elena'$nil&lt;br /&gt;@call 'program'input&lt;br /&gt;@push $elena'$nil&lt;br /&gt;@send get&lt;br /&gt;@send write&lt;br /&gt;@new $elena'$group&lt;br /&gt;@copy 1&lt;br /&gt;@group-add&lt;br /&gt;@push std'patterns'ewhilenotzero&lt;br /&gt;@group-add&lt;br /&gt;@sub&lt;br /&gt;  @push $elena'$nil&lt;br /&gt;  @call 'program'output&lt;br /&gt;  @copy 1&lt;br /&gt;  @send write&lt;br /&gt;  @pop&lt;br /&gt;  @push $elena'$nil&lt;br /&gt;  @call 'program'input&lt;br /&gt;  @push $elena'$nil&lt;br /&gt;  @send get&lt;br /&gt;  @send write&lt;br /&gt;@end&lt;br /&gt;@send run&lt;br /&gt;@pop&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-598697241904602536?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/598697241904602536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/09/elena-virtual-machine-script-bf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/598697241904602536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/598697241904602536'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/09/elena-virtual-machine-script-bf.html' title='ELENA Virtual Machine Script: BF interpreter'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-2912359984684053089</id><published>2011-08-01T15:34:00.000-07:00</published><updated>2012-02-16T08:23:33.285-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='what&apos;s new'/><title type='text'>ELENA 1.6.3 released</title><content type='html'>&lt;a href="https://sourceforge.net/projects/elenalang/files/ELENA/1.6.3/"&gt;&lt;b&gt;ELENA 1.6.3 is out now&lt;/b&gt;&lt;/a&gt;&lt;p&gt;This release includes several language enhancements beta version of ELENA script engine, refactored LIB2 and beta version of GCX. All samples (except upndown) are migrated to lib2.&lt;/p&gt;&lt;p&gt;Other changes&lt;/p&gt;&lt;ul&gt;&lt;li&gt;@ operator parsing order is changed&lt;/li&gt;&lt;li&gt;#define import subjects as well&lt;/li&gt;&lt;li&gt;argument list is now possible to use with symbol parameter as well&lt;/li&gt;&lt;li&gt;nil subject is no longer supported, use nillable&lt;/li&gt;&lt;li&gt;several bug fixes&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-2912359984684053089?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/2912359984684053089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/08/elena-163-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2912359984684053089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2912359984684053089'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/08/elena-163-released.html' title='ELENA 1.6.3 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-8325102718060528140</id><published>2011-07-15T01:31:00.000-07:00</published><updated>2012-02-16T08:23:11.091-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>LIB2:Conversion to the string</title><content type='html'>&lt;p style="text-align: justify;"&gt;Being a pure object-oriented language ELENA does not support any built-in conversion mechanisms, objects should implement special methods themselves. A standard way to make the object convertible to the string is to implement literal'get method&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyLiteral&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#method literal = "My Class".&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#var aLiteral := MyObject literal.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;If the object is a number it could implement a numeric protocol. In this case the code will look like this:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyNumber&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#method numeric = 5.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#var aLiteral := anObject numeric save: std'basic'WideStrConvert.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note: std'basic'WideStrConvert converts supported numeric values (integer  and real numbers) to the literal one.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Let's use more generic code. In this case we have to implement a conversion protocol.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class MyLiteral&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#method literal = "My Class".&lt;br /&gt;&lt;br /&gt;#method request : anObject = anObject literal:($self literal).&lt;br /&gt;}&lt;br /&gt;#class MyNumber&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#method numeric = 5.&lt;br /&gt;&lt;br /&gt;#method request  :  anObject = anObject save:($self numeric).&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#var aLiteral := MyObject request:{ &lt;br /&gt;literal : aLiteral = aLiteral&lt;br /&gt;&lt;br /&gt;numeric : aNumber = aNumber save:std'basic'WideStrConvert.&lt;br /&gt;}.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note: request method is used to define the object supported "type" (either numeric, literal, indexable and so on).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Alternatively we could use existing symbol std'routines'PrintValue:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var aLiteral := std'routines'PrintValue::MyObject.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;In case if our object is a complex one let's consider a last example (see goods sample)&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class Record&lt;br /&gt;{&lt;br /&gt;#field theName.&lt;br /&gt;&lt;br /&gt;#field thePrice.&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#method literal&lt;br /&gt;[&lt;br /&gt;^ ext'text'TextWriter write:"Name:" write:theName write:" Price:" write:thePrice literal.&lt;br /&gt;]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;'program'output &lt;&lt; MyRecord.&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Note: if PrintValue symbol is used (e.g. in 'program'output) request method may be omitted if the object implements literal'get one.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-8325102718060528140?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/8325102718060528140/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/07/lib2conversion-to-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8325102718060528140'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8325102718060528140'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/07/lib2conversion-to-string.html' title='LIB2:Conversion to the string'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6998686649981852420</id><published>2011-07-09T11:17:00.000-07:00</published><updated>2011-07-09T11:21:38.880-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena virtual machine'/><title type='text'>"Weekly" release - 1.6.2.1</title><content type='html'>&lt;p&gt;This is a weekly service release. Note it is binary incompatible with the previous versions&lt;/p&gt;&lt;ul&gt;&lt;li&gt;-ffriend-injection mingw compiler option was removed&lt;/li&gt;&lt;li&gt;subject implementation overhaul&lt;/li&gt;&lt;li&gt;#define imports subjects as well&lt;/li&gt;&lt;li&gt;nil subject is no longer supported, use nillable&lt;/li&gt;&lt;li&gt;vm terminal refactored&lt;/li&gt;&lt;li&gt;fixed bug in asm2binx: __arg1 is not recognized as a reference for SUB&lt;/li&gt;&lt;li&gt;@ operator parsing order is changed&lt;/li&gt;&lt;li&gt;argument list is now possible to use with symbol parameter as well&lt;/li&gt;&lt;li&gt;script engine refactored&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;You may download it &lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/"&gt;from sourceforge&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6998686649981852420?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6998686649981852420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/07/weekly-release-1621.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6998686649981852420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6998686649981852420'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/07/weekly-release-1621.html' title='&quot;Weekly&quot; release - 1.6.2.1'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-2498439342109799250</id><published>2011-06-27T13:13:00.000-07:00</published><updated>2011-06-27T13:18:52.728-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elenavm'/><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena virtual machine'/><title type='text'>Subject symbols</title><content type='html'>&lt;p style="text-align: justify;"&gt;As I mentioned  in the very first post in this blog when I started ELENA project I decided that the best plan is no plan. After all it is hard to plan if you have only a vague idea of your future programming language. After ten years of development several distinct languages were developed (just compare 1.0.0, 1.4.6, 1.5.1 and 1.6.2)  and the work goes on. So when people (those few who bother to look at) complain that ELENA is a weird or exotic they forget that it is an experimental language and it shouldn't be all shiny (at least until it is in development phase). Its main purpose is to check the proposed concepts. And at the moment it is an open architecture concept.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;This model of development may be called evolutional (yes, in the evolution there is no plan as well). Similar to the real evolution some minor tactical decisions may have a great impact. When I came up with an idea of a message subject I tried to solve a practical question: how to write a real program if you have very limited set of message names. Later it appeared that the subject can be used to implement some kind of multiple dispatching in ELENA. And now (starting from 1.6.3) the subject will be used in VM script engine as a message adapter.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Every time a new subject is declared the appropriate implicit symbol is auto-generated as well (actually two symbols). When the symbol is called without an argument it returns an external role (stateless object) used to invoke a message, otherwise the property wrapper.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So let's look at several use cases. The first case is sending a message. Presume we would like to send a qualified message to the object. Usually it looks like this - anObject verb &amp;subject:aParameter. With the help of the subject symbol we could implement the same code without using subject (remember it is not possible to use subjects in ELENA-script): anObject~subject verb:aParameter. In this code our subject symbol translates verb into subject'verb.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Secondly let's extend an object with a subject property: anObject~(subject::Variable), subject symbol returns a wrapper object around Variable which translates subject'get / subject'set into get / set.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Let's look how this concept can be used in vm terminal. Presume we would like to return the literal constant length: nil 'program'output "abc" nil nil std'dictionary'length &amp;get will print 3.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;One may ask why not to allow to use subjects in the script? Of course it could be easily done but in this case there is no need in subjects at all. We could allow methods to have any names the programmer wants and in the result we will get ... Smalltalk. The need to formalize the class interface was one of the main reasons I started this project. Only time will tell if this approach is feasible but at the moment you may consider this as a basis assumption on which the language is built.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;P.S. The discussed functionality will be implemented in the upcoming weekly release (probably in two week after 1.6.2 release). In the next post I will display how symbol subject can be used to implement bf interpreter.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-2498439342109799250?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/2498439342109799250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/06/subject-symbols.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2498439342109799250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2498439342109799250'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/06/subject-symbols.html' title='Subject symbols'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4043661883368217572</id><published>2011-06-26T05:38:00.000-07:00</published><updated>2011-06-26T06:53:45.388-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>ELENA 1.6.2 released</title><content type='html'>&lt;a href="https://sourceforge.net/projects/elenalang/files/ELENA/1.6.2/"&gt;&lt;b&gt;ELENA 1.6.2 is out now&lt;/b&gt;&lt;/a&gt;&lt;p&gt;This release includes alpha version of ELENA script engine, changes in the language syntax, new library lib2(only console samples are migrated).&lt;/p&gt;&lt;p&gt;Starting from 1.6.2 the migration to a new library LIB2 began. At the moment all console and rosetta stone ones are migrated to LIB2&lt;/p&gt;&lt;p&gt;The work on GCX (a revised garbage collection) continues. Young and old generations are introduced.&lt;/p&gt;&lt;p&gt;ELENA Script Engine is introduced. At the moment it is very early alpha version.&lt;/p&gt;&lt;p&gt;Other changes&lt;/p&gt;&lt;ul&gt;&lt;li&gt;it is possible now to switch to another role inside another one&lt;/li&gt;&lt;li&gt;run-time multi-dispatching&lt;/li&gt;&lt;li&gt;new argument option: nullable&lt;/li&gt;&lt;li&gt;obsolete argument option: norecc&lt;/li&gt;&lt;li&gt;#continue is no longer supported&lt;/li&gt;&lt;li&gt;new statement: #try&lt;/li&gt;&lt;li&gt;some basic byte code optimization rules&lt;/li&gt;&lt;li&gt;new compiler options: g0, ox&lt;/li&gt;&lt;li&gt;some basic byte code optimization rules&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4043661883368217572?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4043661883368217572/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/06/elena-162-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4043661883368217572'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4043661883368217572'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/06/elena-162-released.html' title='ELENA 1.6.2 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-1664650869446305032</id><published>2011-06-10T03:04:00.000-07:00</published><updated>2011-11-18T06:17:09.912-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elenavm'/><category scheme='http://www.blogger.com/atom/ns#' term='self assembly'/><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena virtual machine'/><title type='text'>ELENA Virtual Machine Script</title><content type='html'>&lt;p style="text-align: justify;"&gt;The last year in the article &lt;a href="http://elenalang.blogspot.com/2010/12/elena-programming-language-next-big.html"&gt;The Next Big Thing&lt;/a&gt; I mentioned the intention to create a special VM script to manipulate with the objects. It took me half a year to come up with the possible solution. And though it is a very early alpha a new tool introduced in the current release (bin\elt.exe) put this idea into practice.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So what is ELENA script? First of all it should not be confused with a traditional script language, it has not its own interpreter, grammar, libraries. It is pure a set of instruction for ELENA VM to load existing symbols into the memory and send them messages. So its prime goal is to assemble objects in VM memory with the help of special rules (if it is done from ELENA program it could be considered as a self assembling, hence its name - DSA (dynamic self assembling) rule). The possibility to work with your own objects directly without need to write a special test program could be useful as well. I hope it will find an application for code generations, open architecture systems (as a way to build complex group objects) and so on.&lt;/p&gt;&lt;p style="text-align: justify;"&gt;The actual system consists of VM terminal (elt.exe) and a special script engine (elenasm.dll) working with ELENA Virtual Machine (elenavm.dll). It is designed to be used directly from ELENA program as well (of course if the program is VM client). There are actually two types of script: inline one (which can be used directly with VM without need for the script engine) and grammar driven (where context-free and DSA rules modify the script text to create an inline one, so it could be considered as a additional layer between the client and VM).&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Before I will show how it looks to work with VM terminal I would like to notice that at the moment it is very early alpha version and it is still unstable. Secondly direct script requires some knowledge of ELENA stack machine: a symbol reference should be always preceded by a parameter (if there is no parameter, nil constant should be used), the same is true for the message call. Thirdly only generic messages can be used (without a subject qualifier; actually it was designed for such a use from the beginning). Note also, that the current implementation allows to work only with console applications. There should be a special VM client for GUI applications. And finally it is presumed that you works with LIB2 programs (if you need to use LIB, please change libpath in elt.cfg to ..\lib)&lt;/p&gt;&lt;p style="text-align: justify;"&gt;So let's start the terminal. Inline script should be executed with an option &amp;quot;-i&amp;quot;&lt;/p&gt;&lt;p style="text-align: justify;"&gt;First of all we need to start a virtual machine and load default template&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-i @config win32_vm_console2 @start&lt;/pre&gt;The canonical hello world sample will be looked like this:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-i &amp;nil 'program'output "Hello World!!" ^write&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Let's print the sum of two numbers:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-i &amp;nil 'program'output 2 3 ^add ^write&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Now let's do a bit more complex task and call existing application (it should be compiled before). First of all you have to tell VM where your compiled modules are located&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-i @use "..\examples\binary"&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;And now let's execute the program symbol:&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-i &amp;nil binary'program &amp;nil ^evaluate&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;As you see it is not very convenient way to write the expression (but it could be ok for computer programs). So let's try to use some grammar. I would like to note that the script engine support simple context free grammar. There are several restriction: only one terminal symbol (it should be first) and non-terminal (with except of AB type rule) can be used. So only the following type of rules are allowed:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;S::=aA&lt;/li&gt;&lt;li&gt;S::=a&lt;/li&gt;&lt;li&gt;S::=A&lt;/li&gt;&lt;li&gt;S::=AB&lt;/li&gt;&lt;li&gt;S::=$eps&lt;/li&gt;&lt;/ul&gt;&lt;p style="text-align: justify;"&gt;So let's define our simple rule&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-g print ::= "?" expression;&lt;br /&gt;-g expression ::= $literal;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;(Note $literal is a special terminal mask accepting any literal constant)&lt;/p&gt;&lt;p style="text-align: justify;"&gt;DSA rules are used to provide required symbols and operations.&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-g print =&gt; &amp;nil 'program'output $body ^write;&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;(Note $body indicates the place where rule content is inserted)&lt;/p&gt;&lt;p style="text-align: justify;"&gt;Now let's mark print as a start rule&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-g start ::= print&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;Let's test if our code works&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;? "hello world!!"&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;You could load existing scripts as well&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-c..\examples\opencalc\opencalc.vl2&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;And now you may calculate some basic arithmetic expression&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;?2*3+4*5&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;You may look how your expression is translated into direct script with the following command -ton&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-ton&lt;br /&gt;?2*3+4*5&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;You will see the script listing. To turn the tracing off type the following&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-toff&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;To exit the program, type&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;-q&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;That's all I would like to show in this tutorial. In near future I will show some more complex samples (for example I will implement &lt;a href="http://elenalang.blogspot.com/2011/09/elena-virtual-machine-script-bf.html"&gt;bf interpreter&lt;/a&gt;)&lt;/p&gt;&lt;p style="text-align: justify;"&gt;P.S. Note that in the current implementation several key features are lacking, for example it is not possible to declare variables. I'm going to implement them in the recent releases. Once again it is still unclear if this turns into something more than a nice toy but it is the direction ELENA Program Language Project is moving to.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-1664650869446305032?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/1664650869446305032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/06/elena-virtual-machine-script.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1664650869446305032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1664650869446305032'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/06/elena-virtual-machine-script.html' title='ELENA Virtual Machine Script'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-8724063129144598372</id><published>2011-06-10T03:03:00.000-07:00</published><updated>2011-06-10T03:04:19.074-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>"Weekly" release 1.6.1.2</title><content type='html'>&lt;p&gt;This is a weekly service release.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;optimization: direct method call for constants and external roles&lt;/li&gt;&lt;li&gt;new statement: #try&lt;/li&gt;&lt;li&gt;bsort migrated to lib2&lt;/li&gt;&lt;li&gt;fixed bug with inline class argument hint&lt;/li&gt;&lt;li&gt;vm terminal&lt;/li&gt;&lt;li&gt;script engine&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;You may download it from sourceforge - &lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/elena-1.6.1.2.zip/download"&gt;ELENA 1.6.1.2&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-8724063129144598372?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/8724063129144598372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/06/weekly-release-1612.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8724063129144598372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8724063129144598372'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/06/weekly-release-1612.html' title='&quot;Weekly&quot; release 1.6.1.2'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-5897883734402441570</id><published>2011-05-28T04:38:00.000-07:00</published><updated>2011-05-28T05:43:11.576-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena sample code'/><title type='text'>LIB2: Tutorial, part 1</title><content type='html'>&lt;p&gt;As work continues on LIB2 more samples are moved to it. So it's time to take a look at the changes the new library brought with it&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#symbol Program =&amp;gt;&lt;br /&gt;[&lt;br /&gt;   'program'Output &amp;lt;&amp;lt; "Hello World!!%n".&lt;br /&gt; &lt;br /&gt;   'program'input get.     // wait for any key &lt;br /&gt;].&lt;/pre&gt;&lt;p&gt;As you can see little was changes: a generic message GET is used instead of CHAR'GET. So let's look at more complex sample: words&lt;/p&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#define std'basic'*.&lt;br /&gt;#define std'collections'*.&lt;br /&gt;#define std'patterns'*.&lt;br /&gt;#define ext'text'*.&lt;br /&gt;#define ext'patterns'*.&lt;br /&gt;#define ext'routines'*.&lt;br /&gt;&lt;br /&gt;#subject std'dictionary'*.&lt;br /&gt;&lt;br /&gt;#subject total_words, unique_words.&lt;br /&gt;&lt;br /&gt;// --- WordList ---&lt;br /&gt;&lt;br /&gt;#class WordList&lt;br /&gt;{&lt;br /&gt;    #field theList.&lt;br /&gt;    #field theTotal.&lt;br /&gt;&lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        theList := List.&lt;br /&gt;        theTotal := Integer::0.&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;    #method += aWord&lt;br /&gt;    [&lt;br /&gt;        theTotal += 1.&lt;br /&gt;  &lt;br /&gt;        #if (ListSearching::theList ==aWord)?&lt;br /&gt;            | [ theList += aWord literal. ].&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;    #method total_words = theTotal.&lt;br /&gt;&lt;br /&gt;    #method unique_words = theList count.&lt;br /&gt;&lt;br /&gt;    #annex (theList).&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- Program ---&lt;br /&gt;&lt;br /&gt;#symbol Program =&gt;&lt;br /&gt;[&lt;br /&gt;    'program'output &lt;&lt; "Enter the text(to stop press enter two times):%n".&lt;br /&gt;&lt;br /&gt;    #var aFlag := Boolean &lt;&lt; True.&lt;br /&gt;    #var aText := TextWriter.&lt;br /&gt;    #var aWriter := #annex(aText)&lt;br /&gt;    {&lt;br /&gt;        &lt;&lt; aLiteral&lt;br /&gt;        [&lt;br /&gt;            #if (aLiteral length == 0)?&lt;br /&gt;            [&lt;br /&gt;                aFlag &lt;&lt; False.&lt;br /&gt;            ]&lt;br /&gt;            | [ aText &lt;&lt; aLiteral. ].&lt;br /&gt;        ]&lt;br /&gt;    }.&lt;br /&gt;&lt;br /&gt;    #loop aFlag?&lt;br /&gt;    [    &lt;br /&gt;        'program'Input &gt;&gt; aWriter.&lt;br /&gt;&lt;br /&gt;        aWriter += " ".&lt;br /&gt;    ].&lt;br /&gt;&lt;br /&gt;    #var aList := WordList.&lt;br /&gt;&lt;br /&gt;    WordScan::aText run: aWord =&gt; (aList += aWord).&lt;br /&gt;&lt;br /&gt;    'program'output &lt;&lt; "There are " &lt;&lt; aList unique_words &lt;&lt; " unique words out of " &lt;&lt; aList total_words.&lt;br /&gt;    'program'output &lt;&lt; "%nthe list of unique words:%n".&lt;br /&gt;&lt;br /&gt;    aList~CollectionPrinter save:'program'output.&lt;br /&gt;&lt;br /&gt;    'program'input get. // wait for any key&lt;br /&gt;].&lt;/pre&gt;&lt;p style="text-align: justify;"&gt;The first thing that catch an eye is a possibility to use symbol names without a namespace qualifier or an alias. New modules (like ext'routines) and classes (ext'text'TextWriter) were introduced. ext'patterns'WordEnum was renamed to WordScan. An external role ext'routines'CollectionPrinter is used to print the collection. Qualified messages &lt;b&gt;unique_words&lt;/b&gt; and &lt;b&gt;total_words&lt;/b&gt; are used instead of private ones &lt;b&gt;$getTotal&lt;/b&gt; and &lt;b&gt;$getUnique&lt;/b&gt;. Apart from these the sample logic remains the same: with the help of wordscan the entered text is split into words and only unique words are saved in the collection; the resulting list is printed at the end.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-5897883734402441570?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/5897883734402441570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/05/lib2-tutorial-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5897883734402441570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5897883734402441570'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/05/lib2-tutorial-part-1.html' title='LIB2: Tutorial, part 1'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7564049744374910371</id><published>2011-05-27T13:01:00.000-07:00</published><updated>2011-06-10T02:39:34.335-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>"Weekly" release 1.6.1.1</title><content type='html'>&lt;p&gt;This is a weekly service release. It contains several major changes in ecodes(complete overhaul of ELENA bytecode opcodes, making this release incompatible with 1.6.1), some changes in group support, multiple dispatching. The migration to LIB2 continues, several samples were moved to it&lt;/p&gt;&lt;ul&gt;&lt;li&gt;it is possible now to switch to a role inside another one&lt;/li&gt;&lt;li&gt;new ecode: snop&lt;/li&gt;&lt;li&gt;run-time multi-dispatching&lt;/li&gt;&lt;li&gt;obsolete argument option: norecc&lt;/li&gt;&lt;li&gt;new argument option: nullable&lt;/li&gt;&lt;li&gt;intsum &amp; realsum migrated to lib2&lt;/li&gt;&lt;li&gt;binary migrated to lib2&lt;/li&gt;&lt;li&gt;new compiler option - g0&lt;/li&gt;&lt;li&gt;ecodes are simplified, several big commands are split&lt;/li&gt;&lt;li&gt;#continue is no longer supported&lt;/li&gt;&lt;li&gt;words migrated to lib2&lt;/li&gt;&lt;li&gt;some basic byte code optimization rules&lt;/li&gt;&lt;li&gt;new option to turn on / off optimization - ox&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;You may download it from sourceforge - &lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/ELENA-1.6.1.1.zip/download"&gt;ELENA 1.6.1.1&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The next several posts will discuss what's new in LIB2 comparing with the LIB&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7564049744374910371?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7564049744374910371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/05/weekly-release-1611.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7564049744374910371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7564049744374910371'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/05/weekly-release-1611.html' title='&quot;Weekly&quot; release 1.6.1.1'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3493907529860827424</id><published>2011-05-05T12:40:00.000-07:00</published><updated>2011-05-05T13:52:53.886-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>ELENA 1.6.1 released</title><content type='html'>&lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/1.6.1/elena-1.6.1.zip/download"&gt;&lt;b&gt;ELENA 1.6.1 is out now&lt;/b&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;This major release includes changes in the language syntax, several critical bug fixes and enhancements in the language library code.&lt;/p&gt;&lt;p&gt;1.6.1 is not binary compatible with the previous versions (due to changes in ecodes and a grammar)&lt;/p&gt;&lt;p&gt;&lt;b&gt;multi-threading support&lt;/b&gt;&lt;/p&gt;&lt;p&gt;GCX (a revised garbage collection) is now thread-safe&lt;/p&gt;&lt;p&gt;&lt;b&gt;changes in ecodes (ELENAVM byte codes)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;ul&gt;&lt;li&gt;several “big” commands are split, to reuse existing ecodes (disptach, redirect) &lt;/li&gt;&lt;li&gt;new ecode – popn&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;simplified syntax to create a group&lt;/b&gt;&lt;/p&gt;&lt;p&gt;instead of old style syntax&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#group(events'EHandler, BtmSave) += …&lt;/pre&gt;it is possible to use the following syntax&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;BtmSave~events'EHandler += ..&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;#define command without an alias&lt;/b&gt;&lt;/p&gt;&lt;p&gt;it is possible to include another namespace without providing a namespace shortcut&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#define std'basic'*.&lt;br /&gt;…&lt;br /&gt;Integer &lt;&lt; 2.&lt;br /&gt;&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;new compiler hint syntax&lt;/b&gt;&lt;/p&gt;&lt;p&gt;instead of old style&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#hint(subj:mysubject)&lt;br /&gt;#class MyClass {…}&lt;/pre&gt;a new syntax is introduces&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class(subj:mysubject)MyClass {…}&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;#hint is no longer supported&lt;/b&gt;&lt;/p&gt;&lt;p&gt;the new hint syntax should be used&lt;/p&gt;&lt;p&gt;&lt;b&gt;several major changes in an expression syntax&lt;/b&gt;&lt;/p&gt;&lt;p&gt;The following syntax&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;A verb:B::C&lt;/pre&gt;should be replaced with &lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;A verb:(B::C)&lt;/pre&gt;&lt;br /&gt;An argument list could be used in initializing expression&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;A::&amp;arg1:B &amp;arg2:C&lt;/pre&gt;The following code do not need an extra brackets any more&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#inline alias(A, B, C) verb:D&lt;/pre&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;several bug fixes&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;ul&gt;&lt;li&gt;a bug in memory management&lt;/li&gt;&lt;li&gt;a #group statement bug for x platform&lt;/li&gt;&lt;li&gt;cannot compile class with roles in the release mode bug&lt;/li&gt;&lt;li&gt;#00058: duplicate subjects&lt;/li&gt;&lt;li&gt;#00059: win32_gui_vm_client and win32_console_vm_client applications do not work&lt;/li&gt;&lt;li&gt;#00060: #var a := a verb:b circular referencing&lt;/li&gt;&lt;li&gt;upndown bug:player plays with a joker as a biggest one&lt;/li&gt;&lt;li&gt;bug: 64bit integer numbers are displayed incorrectly in the debugger watch window&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;lib2&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;ul&gt;&lt;li&gt;the work on an alternative system library is began. LIB2 will replace existing one after 1.7.0&lt;/li&gt;&lt;li&gt;hellowworld_u sample migrated to lib2&lt;/li&gt;&lt;/ul&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;IDE&lt;/b&gt;&lt;/p&gt;&lt;p&gt;IDE is now ready to debug multi-threading applications&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3493907529860827424?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3493907529860827424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/05/elena-161-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3493907529860827424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3493907529860827424'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/05/elena-161-released.html' title='ELENA 1.6.1 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6158366122180343707</id><published>2011-04-22T13:24:00.000-07:00</published><updated>2011-04-22T14:33:49.779-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><title type='text'>Weekly release - 1.6.0.3</title><content type='html'>After quite a long period of time I finally made a next release.&lt;br /&gt;&lt;br /&gt;This time it includes several major changes in ELENA byte-codes and syntax.&lt;br /&gt;&lt;br /&gt;- Several "big" bytecode commands (like redirect and dispatch) are split into smaller ones to reuse existing commands. It means 1.6.0.3 is not binary compatible with previous versions.&lt;br /&gt;&lt;br /&gt;- It is possible now to include other symbol namespaces without aliases. I.e. instead of old code:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#define basic'* = std'basic'*.&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;  #var anObject := basic'True.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;it is possible to write the following:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#define std'basic'*.&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;  #var anObject := True.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;- The simplified syntax to create a group. Compare old code&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;           #group(events'EHandler, BtmOk) += &lt;br /&gt;            { on'Click'process = self set &amp;dialog_result:basic'false.  }.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;with a new one:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;           BtmOk~events'EHandler += &lt;br /&gt;            { on'Click'process = self set &amp;dialog_result:basic'false.  }.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;- There is a simplified syntax for providing compiler hints:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#method(disp) += anObject&lt;br /&gt;[&lt;br /&gt;    ...&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The work on an alternative library (lib2) is started. It will eventually replace the existing one starting from 1.7.0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6158366122180343707?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6158366122180343707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/04/weekly-release-1603.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6158366122180343707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6158366122180343707'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/04/weekly-release-1603.html' title='Weekly release - 1.6.0.3'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6706842229763876480</id><published>2011-04-05T01:07:00.000-07:00</published><updated>2011-04-05T01:25:02.781-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>Current status</title><content type='html'>It has been a while since my last post and a last release. So I decided to post a little update on the project status.&lt;br /&gt;&lt;br /&gt;At the moment I'm working on introducing a new concept to the language - external role (or ELENA protocol).&lt;br /&gt;&lt;br /&gt;As you probably remember a role is an alternative VMT. But I realized that there could be an external one. It can be considered as a short-time mutation as well. The good thing is that unlike a normal mutation (either #annex or #group) it does not introduce any performance overload. As a result I will implement an alternative API (so called API2), located in lib2 (the source code in src2).&lt;br /&gt;&lt;br /&gt;So how it will be used? For the programmer there will be nothing new. For example,  we've implemented a protocol __address. To use it we have to write the following: anObject1 __address ifequal:anObject2.&lt;br /&gt;&lt;br /&gt;anObject1 actually may not know anything about the protocol (though in most cases it should implement some methods to support the protocol).&lt;br /&gt;&lt;br /&gt;The next release will contain the first implementation of the protocol concept&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6706842229763876480?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6706842229763876480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/04/current-status.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6706842229763876480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6706842229763876480'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/04/current-status.html' title='Current status'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-1577589908198607698</id><published>2011-03-18T20:31:00.000-07:00</published><updated>2011-03-18T20:50:36.084-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><title type='text'>Weekly release - 1.6.0.2</title><content type='html'>This is a weekly service release. It contains several major bug fixes. &lt;br /&gt;&lt;br /&gt;- fixed #group statement bug for x platform&lt;br /&gt;- fixed critical error: cannot compile class with roles in the release mode&lt;br /&gt;- fixed gui'controls'Combobox-items append method doesn't work with a literal value&lt;br /&gt;&lt;br /&gt;As a part of the compiler development (x project) the work on multi-threading support was continued. IDE is now fully ready for debugging several multi-thread applications;&lt;br /&gt;new modules:sys'threading, win32'api'threading.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-1577589908198607698?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/1577589908198607698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/03/weekly-release-1602.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1577589908198607698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1577589908198607698'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/03/weekly-release-1602.html' title='Weekly release - 1.6.0.2'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7982031499502470795</id><published>2011-03-04T03:00:00.001-08:00</published><updated>2011-11-23T04:03:15.096-08:00</updated><title type='text'>Rosseta code tutorials:Arithmetic evaluation</title><content type='html'>&lt;div style="text-align: justify;"&gt;Today, let's consider another rosetta code sample - &lt;a href="http://rosettacode.org/wiki/Arithmetic_evaluation"&gt;Arithmetic evaluation&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;We have to evaluate an arithmetic expression by building the parsing tree. So let's define tree elements being used by the parser:&lt;/div&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#subject parse_order.&lt;br /&gt;&lt;br /&gt;// --- Token ---&lt;br /&gt;&lt;br /&gt;#class Token&lt;br /&gt;{&lt;br /&gt;    #field theValue.&lt;br /&gt;    &lt;br /&gt;    #method parse_order'get = 0.&lt;br /&gt;    &lt;br /&gt;    #method += aChar&lt;br /&gt;    [&lt;br /&gt;        theValue += aChar.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method + aNode&lt;br /&gt;    [&lt;br /&gt;        ^ aNode += self.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        theValue := String.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method numeric = theValue save:Real64Convertor.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- Node ---&lt;br /&gt;&lt;br /&gt;#class Node&lt;br /&gt;{&lt;br /&gt;    #field theLeft.&lt;br /&gt;    #field theRight.&lt;br /&gt;    &lt;br /&gt;    #role Empty&lt;br /&gt;    {&lt;br /&gt;        #method += aNode&lt;br /&gt;        [&lt;br /&gt;            theLeft := aNode.&lt;br /&gt;            &lt;br /&gt;            $self $setLeftAssigned.&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #role LeftAssigned&lt;br /&gt;    {&lt;br /&gt;        #method += aNode&lt;br /&gt;        [&lt;br /&gt;            theRight := aNode.&lt;br /&gt;            &lt;br /&gt;            #shift.&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #method $setLeftAssigned&lt;br /&gt;    [&lt;br /&gt;        #shift LeftAssigned.&lt;br /&gt;    ]&lt;br /&gt;&lt;br /&gt;    #method + aNode&lt;br /&gt;    [&lt;br /&gt;        #if (self parse_order &gt; aNode parse_order)?&lt;br /&gt;        [&lt;br /&gt;            self += aNode.&lt;br /&gt;        ]&lt;br /&gt;        | [&lt;br /&gt;            aNode += self.&lt;br /&gt;            &lt;br /&gt;            ^ aNode.&lt;br /&gt;        ].&lt;br /&gt;    ]&lt;br /&gt;        &lt;br /&gt;    #method += aNode&lt;br /&gt;    [&lt;br /&gt;        #if (theRight parse_order &gt; aNode parse_order)?&lt;br /&gt;        [&lt;br /&gt;            theRight += aNode.&lt;br /&gt;        ]&lt;br /&gt;        | [&lt;br /&gt;            theRight := aNode += theRight.&lt;br /&gt;        ].        &lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        #shift Empty.&lt;br /&gt;    ]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- SummaryNode&lt;br /&gt;&lt;br /&gt;#class SummaryNode (Node)&lt;br /&gt;{&lt;br /&gt;    #method parse_order'get = 2.&lt;br /&gt;    &lt;br /&gt;    #method numeric = theLeft numeric + theRight numeric.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- DifferenceNode ---&lt;br /&gt;&lt;br /&gt;#class DifferenceNode (Node)&lt;br /&gt;{&lt;br /&gt;    #method parse_order'get = 2.&lt;br /&gt;    &lt;br /&gt;    #method numeric = theLeft numeric - theRight numeric.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- ProductNode ---&lt;br /&gt;&lt;br /&gt;#class ProductNode (Node)&lt;br /&gt;{&lt;br /&gt;    #method parse_order'get = 1.&lt;br /&gt;    &lt;br /&gt;    #method numeric = theLeft numeric * theRight numeric.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- FractionNode ---&lt;br /&gt;&lt;br /&gt;#class FractionNode (Node)&lt;br /&gt;{&lt;br /&gt;    #method parse_order'get = 1.&lt;br /&gt;    &lt;br /&gt;    #method numeric = theLeft numeric / theRight numeric.&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Our tree will consist of Token instances (leaf nodes) and Node descendants (branch node). Any branch branch may have two children. So the expression 1+2+3 will be presented like this:&lt;/div&gt;&lt;br /&gt;&lt;pre&gt;       --(+)----&lt;br /&gt;      |         |&lt;br /&gt;  -- (+)--     [3]&lt;br /&gt; |        |&lt;br /&gt;[1]      [2]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;To correctly parse the expression like 1+2*3 any node should return its precedence level (parsing order). That's why we declare a new property (actually new subject) - parse_order. The tree is evaluated by sending real'get message to the top node, which in turn sends it to its children until we reach terminal node (Token). Each brunch node (SummaryNode, DifferenceNode and so on) performs the associated operation with the results and at the end we've got the result of the expression.&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Let's consider some parts of the code. Token's numeric'get method converts the literal value to a numeric one:&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;theValue save:Real64Convertor&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Add message (operator +) is used to connect two nodes with each other in accordance with their precedence levels. To add children nodes to the brunch one append message (+= operator) should be used. Note the use of roles there. Instead of checking each time if the sub node was already attached we define two roles - Empty and LeftAssigned. Due to current implementation limitation we cannot switch from one role to another one inside the role so a private method is used ($setLeftAssigned).&lt;br /&gt;To support precedence-control parentheses we have to declare a special node - SubExpression. It is actually a sub tree. Note, we have to use Parser class before its declaration. It can be done by providing the symbol namespace (if our module is named as arithmeval - arithmeval'Parser).&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class SubExpression&lt;br /&gt;{&lt;br /&gt;    #field theParser.&lt;br /&gt;    #field theCounter.&lt;br /&gt;    &lt;br /&gt;    #role EOF&lt;br /&gt;    {&lt;br /&gt;        #method eof'is []&lt;br /&gt;        &lt;br /&gt;        #method += aChar [ $self fail. ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #method parse_order'get = 0.&lt;br /&gt;    &lt;br /&gt;    #method + aNode&lt;br /&gt;    [&lt;br /&gt;        ^ aNode += self.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method append : aChar&lt;br /&gt;    [&lt;br /&gt;        #var aCode := Int32Value::aChar.&lt;br /&gt;&lt;br /&gt;        #if control if:(aCode == 41)&lt;br /&gt;        [&lt;br /&gt;            theCounter -= 1.&lt;br /&gt;        ]&lt;br /&gt;        | if:(aCode == 40)&lt;br /&gt;        [&lt;br /&gt;            theCounter += 1.&lt;br /&gt;        ].&lt;br /&gt;        &lt;br /&gt;        #if(theCounter == 0)?&lt;br /&gt;            [ #shift EOF. ^ $self. ].&lt;br /&gt;        &lt;br /&gt;        theParser evaluate:aChar.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method numeric = theParser numeric.&lt;br /&gt;    &lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        theParser := arithmeval'Parser.&lt;br /&gt;        theCounter := Integer &lt;&lt; 1.&lt;br /&gt;    ]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;The field theCounter is used to deal with nested parentheses.Now let's declare our parser class. &lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class Parser&lt;br /&gt;{&lt;br /&gt;    #field theToken.&lt;br /&gt;    #field theTopNode.&lt;br /&gt;    &lt;br /&gt;    #role Start&lt;br /&gt;    {&lt;br /&gt;        #method evaluate : aChar&lt;br /&gt;        [&lt;br /&gt;            #if (40 == aChar)?&lt;br /&gt;            [&lt;br /&gt;                theToken := SubExpression.&lt;br /&gt;                theTopNode := theToken.&lt;br /&gt;                &lt;br /&gt;                $self $setBrackets.&lt;br /&gt;            ]&lt;br /&gt;            | [&lt;br /&gt;                theToken := Token.&lt;br /&gt;                theTopNode := theToken.&lt;br /&gt;                &lt;br /&gt;                theToken += aChar.&lt;br /&gt;                &lt;br /&gt;                #shift.&lt;br /&gt;            ].&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #role Brackets&lt;br /&gt;    {&lt;br /&gt;        #method evaluate : aChar&lt;br /&gt;        [&lt;br /&gt;            theToken += aChar.&lt;br /&gt;            &lt;br /&gt;            #if theToken eof'is&lt;br /&gt;            [&lt;br /&gt;                #shift.&lt;br /&gt;            ].&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #role Operator&lt;br /&gt;    {&lt;br /&gt;        #method evaluate : aChar&lt;br /&gt;        [&lt;br /&gt;            #if Control if:(48 &lt; aChar) if:(58 &gt; aChar)&lt;br /&gt;            [&lt;br /&gt;                theToken := (Token += aChar).&lt;br /&gt;                &lt;br /&gt;                theTopNode += theToken.&lt;br /&gt;                &lt;br /&gt;                #shift.&lt;br /&gt;            ]&lt;br /&gt;            | if:(40 == aChar)&lt;br /&gt;            [&lt;br /&gt;                theToken := SubExpression.&lt;br /&gt;                theTopNode += theToken.&lt;br /&gt;                &lt;br /&gt;                #shift Brackets.&lt;br /&gt;            ]&lt;br /&gt;            | [ $self fail. ].&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #method numeric = theTopNode numeric.&lt;br /&gt;    &lt;br /&gt;    #method evaluate : aChar&lt;br /&gt;    [&lt;br /&gt;        #if Control if:(48 &lt; aChar) if:(58 &gt; aChar)&lt;br /&gt;        [&lt;br /&gt;            theToken += aChar.&lt;br /&gt;        ]&lt;br /&gt;        | if:(42 == aChar)  // *&lt;br /&gt;        [&lt;br /&gt;            theTopNode := theTopNode + ProductNode.&lt;br /&gt;            &lt;br /&gt;            #shift Operator.&lt;br /&gt;        ]&lt;br /&gt;        | if:(47 == aChar)  // /&lt;br /&gt;        [&lt;br /&gt;            theTopNode := theTopNode + FractionNode.&lt;br /&gt;            &lt;br /&gt;            #shift Operator.&lt;br /&gt;        ]&lt;br /&gt;        | if:(43 == aChar)  // +&lt;br /&gt;        [&lt;br /&gt;            theTopNode := theTopNode + SummaryNode.&lt;br /&gt;            &lt;br /&gt;            #shift Operator.&lt;br /&gt;        ]&lt;br /&gt;        | if:(45 == aChar)  // -&lt;br /&gt;        [&lt;br /&gt;            theTopNode := theTopNode + DifferenceNode.&lt;br /&gt;            &lt;br /&gt;            #shift Operator.&lt;br /&gt;        ]&lt;br /&gt;        | if:(40 == aChar)&lt;br /&gt;        [&lt;br /&gt;            theToken := SubExpression.&lt;br /&gt;            theTopNode := theToken.&lt;br /&gt;            &lt;br /&gt;            #shift Brackets.&lt;br /&gt;        ]&lt;br /&gt;        | [ $self fail. ].&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        #shift Start.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method $setBrackets&lt;br /&gt;    [&lt;br /&gt;        #shift Brackets.&lt;br /&gt;    ]&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Parser is an action class used by a literal enumerator. Evaluate method is called for every expression character to build the parser tree. Once again the roles are used to deal with special cases (like parentheses).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;Parser class gives us an opportunity to speak about conditional statements in ELENA. Because the language does not have any built-in types it is problematic to implement classical conditional statements. One possible solution is implemented in Smalltalk where closures are used (the similar could be done in ELENA as well). The second solution used by the language takes into account another ELENA feature - alternative flow: if the object does not react to the message (no appropriate record in VMT) the flow is considered to be broken and control goes to the alternative one. So the conditional statement in the language looks like this:&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if anObject message1:aParameter1 // first condition&lt;br /&gt;[&lt;br /&gt;   ....&lt;br /&gt;]&lt;br /&gt;| message2:aParameter2  // second condition (optional)&lt;br /&gt;[ &lt;br /&gt;   ... &lt;br /&gt;]&lt;br /&gt;|    // else condition (optional) &lt;br /&gt;[&lt;br /&gt;   ...&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Though conditional statement can be used with any message, operators ? (is) and ! (isnot) are used in ELENA API. It is presumed that a true value (std'basic'True symbol) reacts to ? operator and a false one (std'basic'False) to ! operator. So the conditional statement may look like this&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if aFlag?&lt;br /&gt;[&lt;br /&gt;   // true part&lt;br /&gt;]&lt;br /&gt;| ! [&lt;br /&gt;   // false part&lt;br /&gt;]&lt;br /&gt;| [&lt;br /&gt;    // error part&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Comparison operators (==, !=, &gt;, &lt; and so on) returns either true or false values (or fails if the operands are not compatible). So we could write like this&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if (32 &lt; aChar)?&lt;br /&gt;[&lt;br /&gt;   ...&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Note that we compare an integer to the character rather than other way around - to convert character value to a numeric one.&lt;/div&gt;&lt;br/&gt;&lt;div style="text-align: justify;"&gt;If several conditions are required we could use 'and' and 'or' messages (supported by boolean symbols)&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if (48 &lt; aChar) and:(58 &gt; aChar)&lt;br /&gt;[&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Note, that in this case both condition are evaluated (unlike C++ for example). But it is still possible to achieve using std'patterns'Control symbol&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if Control if:(48 &lt; aChar) if:(58 &gt; aChar)&lt;br /&gt;[&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;In this case if the first condition is not true the control goes immediately to the alternative part (if presented).&lt;/div&gt;&lt;div style="text-align: justify;"&gt;And finally, the conditional statement (as well as a loop one) does not break the flow if the message fails and there is no alternative statements (as opposed to a normal statement). That why we have to break it ourselves (if we want to inform the method caller that the operation is failed).&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#if Control if:(48 &lt; aChar) if:(58 &gt; aChar)&lt;br /&gt;[&lt;br /&gt;   theToken += aChar.&lt;br /&gt;]&lt;br /&gt;...&lt;br /&gt;| [&lt;br /&gt;   $self fail.&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;It is presumed that fail message is never handled.&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#symbol Program =&gt;&lt;br /&gt;[&lt;br /&gt;    #var aText := String.&lt;br /&gt;    &lt;br /&gt;    #loop ((Console &gt;&gt; aText) length &gt; 0)?&lt;br /&gt;    [&lt;br /&gt;        #var aParser := Parser.&lt;br /&gt;&lt;br /&gt;        Console &lt;&lt; "=" &lt;&lt; aText then: aText =&gt;&lt;br /&gt;        [&lt;br /&gt;            Scan::aText run:aParser.&lt;br /&gt;            &lt;br /&gt;            ^ aParser numeric.&lt;br /&gt;        ]&lt;br /&gt;        | &lt;&lt; "Invalid Expression".&lt;br /&gt;        &lt;br /&gt;        Console &lt;&lt; "%n".&lt;br /&gt;    ].&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;The main program body is quite simple. We read the user input, parse it and prints the result (or an error message if the expression is invalid) until the user enters the empty line. ctrl'Control-then method evaluates the action (closure; a la Smalltalk) and returns the result.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7982031499502470795?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7982031499502470795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/03/rosseta-code-tutorialsarithmetic.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7982031499502470795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7982031499502470795'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/03/rosseta-code-tutorialsarithmetic.html' title='Rosseta code tutorials:Arithmetic evaluation'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-8340730994687634139</id><published>2011-02-28T05:20:00.000-08:00</published><updated>2012-02-16T08:26:09.644-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena rosseta code'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Rosetta Code: Arrays</title><content type='html'>&lt;div style="text-align: justify;"&gt;Today, let's discuss the work with array (In this post I combined several tasks).&lt;br /&gt;First, &lt;a href="http://rosettacode.org/wiki/Arrays"&gt;lets' show the basic array syntax&lt;/a&gt;&lt;br /&gt;There are several ways how to declare the array in ELENA. The simplest way looks like this&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anArray := (1, 2, 3).&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Note that the array is an object containing the references to the integer objects rather than values itself.  By default the array object inherits std'basic'Array class.&lt;br /&gt;The syntax to retrieve the element is quite simple:&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anItem := anArray@1.&lt;/pre&gt;Note that @ message returns the indexer proxy rather than the element itself. If you wish to retrieve the object itself the code should be a bit more complex:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anItem := (anArray@1) content.&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;To find out the difference between these variants let's examine the concept of an indexer. The indexer is a special adapter allowing to access the array members. To create indexer it is enough to send indexer message&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anIndexer := anArray indexer.&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;The indexer can retrieve or assign the current array element with content'get / content'set methods (note that set method works only for dynamic arrays) and navigate the array (it is similar to the C array pointer). So to retrieve the element we have to create an array, move to the required position and return the content:&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anArray indexer write &amp;index:1.&lt;br /&gt;&lt;/pre&gt;But it is possible to use more simple way with the help of "refer" message (@ operand).&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anArray @ 1.&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;Let's consider the following sample:&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;ctrl'It::anArray run : anItem =&gt;&lt;br /&gt;[&lt;br /&gt;   'program'Output &lt;&lt; anItem &lt;&lt; "%n".&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;In this code we print every member of the array. Note that the object is extended with its index.&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;ctrl'It::anArray run : anItem =&gt;&lt;br /&gt;[&lt;br /&gt;'program'Output &lt;&lt; "a[" &lt;&lt; anItem index &lt;&lt; "]=" &lt;&lt; anItem &lt;&lt; "%n".&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://rosettacode.org/wiki/Apply_a_callback_to_an_array"&gt;We could use an enumerator as well&lt;/a&gt;. In this case the object rather then  the indexer is used:&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;ctrl'Scan::anArray run : anItem =&gt;&lt;br /&gt;[&lt;br /&gt;   program'Output &lt;&lt; anItem &lt;&lt; "%n".&lt;br /&gt;]&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;If we would like to get the original object from the proxy (for example if it should be assigned to the class field, in this case it is not optimal to store the proxy) we should use content'get message:&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anArray@1 content.&lt;br /&gt;&lt;/pre&gt;Now let's see how could we create a dynamic array:&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#var anArray := basic'NewArray::3.&lt;br /&gt;&lt;/pre&gt;In most cases there is no difference between the constant and the dynamic one except assigning the value:&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anArray@0 set &amp;content:2.&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;I hope it is clear now why we have to do it this way.After a dynamic array is created all its members are nil. Though it is possible to create and fill the array at the same time&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;anArray := factory'NewArray::{ &amp;factory'array_size:3 &amp;factory'pattern:(Integer::0) }.&lt;br /&gt;&lt;/pre&gt;And finally let's consider the code &lt;a href="http://rosettacode.org/wiki/Averages/Arithmetic_mean"&gt;to calculate the mean(arithmetic average) of a numeric vector.&lt;/a&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#define std'basic'*.&lt;br /&gt;#define std'patterns'*.&lt;br /&gt;#define std'dictionary'*.&lt;br /&gt;&lt;br /&gt;// --- Sum ---&lt;br /&gt;&lt;br /&gt;#class MeanAction&lt;br /&gt;{&lt;br /&gt;    #field theValue.&lt;br /&gt;    #field theCount.&lt;br /&gt;    &lt;br /&gt;    #role Empty&lt;br /&gt;    {&lt;br /&gt;        #method numeric'get = 0.&lt;br /&gt;        &lt;br /&gt;        #method evaluate : aValue&lt;br /&gt;        [&lt;br /&gt;            theValue := Real::0.&lt;br /&gt;            theCount := Integer::0.&lt;br /&gt;            &lt;br /&gt;            #shift.&lt;br /&gt;            &lt;br /&gt;            self evaluate:aValue.&lt;br /&gt;        ]&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    #method new&lt;br /&gt;    [&lt;br /&gt;        #shift Empty.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method numeric'get = theValue / theCount.&lt;br /&gt;    &lt;br /&gt;    #method evaluate : aValue&lt;br /&gt;    [&lt;br /&gt;        theCount += 1.&lt;br /&gt;        &lt;br /&gt;        theValue += aValue.&lt;br /&gt;    ]&lt;br /&gt;    &lt;br /&gt;    #method start : aPattern&lt;br /&gt;    [&lt;br /&gt;        aPattern run:self.&lt;br /&gt;        &lt;br /&gt;        ^ self numeric.&lt;br /&gt;    ]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// --- Program ---&lt;br /&gt;&lt;br /&gt;#symbol Program =&gt;&lt;br /&gt;[&lt;br /&gt;    'program'Output &lt;&lt; MeanAction start:Scan::(1, 2, 3, 4, 5, 6, 7, 8).&lt;br /&gt;].&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;In short we execute the special action object for every member of the collection (or an array) and then print the result. The program code is quite simple (once again we use an enumeration, but this type with implicit action object instead of anonymous one), so let's look more precisely at MeanAction.Enumeration code pattern executes the action for every member of the collection by sending "evaluate" message (=&gt; operator) with the collection member. So we have to declare this method and calculate the total sum simultaneously counting the numbers. "numeric'get" method returns the array mean. In the object constructor we initialize the action fields. Till this moment all is quite straightforward. But there is a special case - zero vector (an array with zero members). If we try to return the mean for it the program will crash with divide by zero exception. So we are creating a special set of methods (Empty role) to deal with it and switch the object to it (#shift Role). If evaluate method is called at least once than the vector is not zero and we have to use the standard set of methods (statement #shift).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-8340730994687634139?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/8340730994687634139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/02/rosetta-code-arrays.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8340730994687634139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8340730994687634139'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/02/rosetta-code-arrays.html' title='Rosetta Code: Arrays'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3524579380077152105</id><published>2011-02-25T08:01:00.000-08:00</published><updated>2011-02-25T09:10:40.958-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena rosseta code'/><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena sample code'/><title type='text'>Rosseta code tutorials:Amb operator</title><content type='html'>&lt;div style="text-align: justify;"&gt;Practically from the very start I had a problem with finding interesting samples to be implemented on ELENA. And only recently I found a place where I could find &lt;a href="http://rosettacode.org/"&gt;them&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So I'm continuing implementing these tasks. My next sample is &lt;a href="http://rosettacode.org/wiki/Amb"&gt;Amb operator&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Let's consider several tasks - one (with literals) from &lt;a href="http://rosettacode.org/wiki/Amb"&gt;rosetta code&lt;/a&gt; (i.e. it is a failure if the last character of word 1 is not equal to the first character of word 2, and similarly with word 2 and word 3, as well as word 3 and word 4) and another (with numeric) from &lt;a href="http://www.randomhacks.net/articles/2005/10/11/amb-operator%20"&gt;here&lt;/a&gt;. We will call them Program1 and Program2.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#symbol Program1 =&gt;&lt;br /&gt;[&lt;br /&gt;    #var A := AmbValue::(1, 2, 3).&lt;br /&gt;    #var B := AmbValue::(4, 5, 6).&lt;br /&gt;&lt;br /&gt;    AmbOperator::(A, B) seek: =&gt; (A * B== 8).&lt;br /&gt;    &lt;br /&gt;    'program'Output &lt;&lt; A &lt;&lt; "*" &lt;&lt; B &lt;&lt; "=8".&lt;br /&gt;].&lt;br /&gt;&lt;br /&gt;#symbol Join =&lt;br /&gt;{&lt;br /&gt;    if &amp;first:aFirst &amp;second:aSecond&lt;br /&gt;    [&lt;br /&gt;        ^ aFirst@(aFirst length - 1) == aSecond@0.&lt;br /&gt;    ]&lt;br /&gt;}.&lt;br /&gt;&lt;br /&gt;#symbol Joinable : aPair = Join if:ctrl'Args::aPair.&lt;br /&gt;&lt;br /&gt;#symbol Program2 =&gt;&lt;br /&gt;[&lt;br /&gt;    #var A := AmbValue::("the","that","a").&lt;br /&gt;    #var B := AmbValue::("frog", "elephant", "thing").&lt;br /&gt;    #var C := AmbValue::("walked", "treaded", "grows").&lt;br /&gt;    #var D := AmbValue::("slowly", "quickly").&lt;br /&gt;&lt;br /&gt;    AmbOperator::(A, B, C, D) seek:&lt;br /&gt;       =&gt; (Joinable::(A,B) and:Joinable::(B,C) and:Joinable::(C,D)).&lt;br /&gt;    &lt;br /&gt;    'program'Output &lt;&lt; A &lt;&lt; " " &lt;&lt; B &lt;&lt; " " &lt;&lt; C &lt;&lt; " " &lt;&lt; D.&lt;br /&gt;].&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;How does Amb operator work? At first we have to define set of possible values for amb operator to choose from (AmbValue). Then we ask AmbOperator to find a correct subset. Joinable symbol is used for a tricky condition of the rosetta code sample (a@(a length)==b@0). ctrl'Args symbol is used to simplify the symbol argument list (i.e.  Join if:ctrl'Args::(a, b) is similar to Join if:{ first'get = A. second'get = B. } or Join if:(&amp;amp;first:A &amp;amp;second:B)).&lt;br /&gt;&lt;br /&gt;So let's consider the code to implement Amb operator.&lt;br /&gt;We start with a multi-list enumerator. I would like to remind that an enumerator is used in ELENA to execute an action for every member of a collection (similar to foreach statement in C#). Why we need an enumerator? To find a correct solution AmbOperator has to go over all possible combinations of amb operands. So let's implement it (it is declared in ext'patterns module):&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#class MultiEnumerator&lt;br /&gt;{&lt;br /&gt;  #field theEnumerators.&lt;br /&gt;&lt;br /&gt;  #role BOF&lt;br /&gt;  {&lt;br /&gt;      #method proceed&lt;br /&gt;      [&lt;br /&gt;          #shift.&lt;br /&gt;        &lt;br /&gt;          ctrl'Control run &amp;amp;list:theEnumerators &amp;amp;foreach:anEnumerator =&gt; (anEnumerator proceed).&lt;br /&gt;        &lt;br /&gt;          ^ basic'True.&lt;br /&gt;      ]&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  #method enumerator = $self.&lt;br /&gt;&lt;br /&gt;  #method proceed&lt;br /&gt;  [&lt;br /&gt;      #var aRetVal := ctrl'Control run &amp;amp;list:theEnumerators &amp;amp;foreach:anEnumerator =&gt;&lt;br /&gt;      [&lt;br /&gt;          #if(anEnumerator proceed)?&lt;br /&gt;              [ ^ basic'False. ].&lt;br /&gt;            &lt;br /&gt;          anEnumerator clear proceed.&lt;br /&gt;      ].&lt;br /&gt;    &lt;br /&gt;      ^ (basic'nilValue != aRetVal).&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method new : aCollection&lt;br /&gt;  [&lt;br /&gt;      #shift BOF.&lt;br /&gt;    &lt;br /&gt;      theEnumerators := basic'ArrayType evaluate &amp;amp;__array &amp;amp;count:(aCollection count) &amp;amp;filling: aCurrent =&gt; (aCollection@(aCurrent indexer) enumerator).&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method get = nil.&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;There is nothing special there. In the construct we create a list of enumerators for every member of the parameter. There is a special use case at the beginning (role BOF) where all enumerators are initialized (first call of proceed method). With each next call of proceed method the first enumeration goes on until it reaches the end, then it is repeated for the next member of the second enumeration and so on until the last enumeration is finished.&lt;br /&gt;&lt;br /&gt;Now we need AmbValue enumerator:&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#class AmbEnumerator&lt;br /&gt;{&lt;br /&gt;  #field theValues.&lt;br /&gt;&lt;br /&gt;  #role BOF&lt;br /&gt;  {&lt;br /&gt;      #method proceed&lt;br /&gt;      [&lt;br /&gt;          theValues $reset.&lt;br /&gt;        &lt;br /&gt;          #shift.&lt;br /&gt;        &lt;br /&gt;          ^ basic'True.&lt;br /&gt;      ]&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  #method new : Values&lt;br /&gt;  [&lt;br /&gt;      theValues := Values.&lt;br /&gt;    &lt;br /&gt;      #shift BOF.&lt;br /&gt;  ]&lt;br /&gt; &lt;br /&gt;  #method proceed&lt;br /&gt;  [&lt;br /&gt;      ^ theValues $next.&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method clear&lt;br /&gt;  [&lt;br /&gt;      #shift BOF.&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method get = theValues.&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;AmbEnumerator is actually an adapter which dynamically modify (mutate) AmbValue by calling private methods - $reset (AmbValue is wrapped around the first member of its  collection) and $next (AmbValue is wrapped around the next one).&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#class AmbValue&lt;br /&gt;{&lt;br /&gt;  #field theValues.&lt;br /&gt;  #field theCurrent.&lt;br /&gt;&lt;br /&gt;  #method enumerator = AmbEnumerator::self.&lt;br /&gt;&lt;br /&gt;  #method $reset&lt;br /&gt;  [&lt;br /&gt;      theCurrent := theValues@0.&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method $next&lt;br /&gt;  [&lt;br /&gt;      #var anIndexer := theCurrent indexer.&lt;br /&gt;    &lt;br /&gt;      anIndexer += 1.&lt;br /&gt;    &lt;br /&gt;      ^ anIndexer eof'is back:basic'False | back:basic'True.&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #method new : Values&lt;br /&gt;  [&lt;br /&gt;      theValues := Values.&lt;br /&gt;      theCurrent := nil.&lt;br /&gt;  ]&lt;br /&gt;&lt;br /&gt;  #union (theCurrent primary).&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;As I said before AmbValue is a proxy class (dynamic extension) over the collection of possible values. Only one value at the time can be accessible (statement #union). "Primary" message is used to return the actual object (note that theCurrent is an indexer).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;And finally our AmbOperator&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#symbol AmbOperator : Values =&lt;br /&gt;{&lt;br /&gt;  seek : anExpression&lt;br /&gt;  [&lt;br /&gt;      ctrl'Control run &amp;amp;enumerator:exctrl'MultiEnumerator::Values &amp;amp;foreach: aCurrent =&gt;&lt;br /&gt;      [&lt;br /&gt;          ^ anExpression evaluate inverted.&lt;br /&gt;      ].&lt;br /&gt;  ]&lt;br /&gt;}.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So how does it work? The key is AmbValue. With a help of ELENA magic AmbValue could be wrapped around one of its members.&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;    #var A := AmbValue::(1, 2, 3).&lt;br /&gt;  #var B := AmbValue::(4, 5, 6).&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;At the beginning A and B points to nil objects. But if we will call $reset method they will be equal to 1 and 4 integer constants (actually are wrapped around them, bit for other parts of the program they ARE integer numbers). After we call $next method they will be 2 and 4. Others are quite simple. AmbOperator with the help of MultiEnumerator executes the required expression for every possible combination of A and B values (i.e. 1 and 4, 1 and 5, 1 and 6, 2 and 4 and so on) until the expression is true (A * B = 8). Et voila!&lt;br /&gt;&lt;br /&gt;P.S. The code works for ELENA API starting from 1.6.0.1 (I'm going to release it very soon). I added exctrl'MultiEnumerator and fixed several bugs in indexer implementation (without them the code for Join symbol should be like this: (aFirst literal)@(aFirst literal length - 1) == (aSecond literal)@0.).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3524579380077152105?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3524579380077152105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/02/rosseta-code-tutorialsamb-operator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3524579380077152105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3524579380077152105'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/02/rosseta-code-tutorialsamb-operator.html' title='Rosseta code tutorials:Amb operator'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4529067830054392459</id><published>2011-01-28T15:10:00.001-08:00</published><updated>2012-02-16T08:27:42.928-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena rosseta code'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Rosseta code tutorials:Add a variable to a class instance at run-time</title><content type='html'>Another Rosetta code sample &lt;a href="http://rosettacode.org/wiki/Add_a_variable_to_a_class_instance_at_runtime#Elena"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Though ELENA does not support adding a function / variable at a run time this could be simulated with the help of a group object (Note that ELENA does not allow a direct access to the object fields at all).&lt;br /&gt;&lt;br /&gt;So we have to create a group member FieldContainer which will hold the variable and a pair of the methods to access it (get / set).&lt;br /&gt;&lt;br /&gt;First of we have to declare a new subject (a property name) - foo&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#subject foo.&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then a property container:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;#class FieldContainer&lt;br /&gt;{&lt;br /&gt;#field theValue.&lt;br /&gt;&lt;br /&gt;#method foo'set : anObject&lt;br /&gt;[&lt;br /&gt;theValue := anObject.&lt;br /&gt;]&lt;br /&gt;&lt;br /&gt;#method foo'get = theValue.&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So now we could extends any existing object&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;// adding a field&lt;br /&gt;anObject := #group(anObject, FieldContainer).&lt;br /&gt;&lt;br /&gt;anObject set &amp;foo:"bar".&lt;br /&gt;&lt;br /&gt;#var aConstant := #group("My String", FieldContainer).&lt;br /&gt;aConstant set &amp;foo:"boo".&lt;br /&gt;&lt;br /&gt;'program'Output &lt;&lt; anObject foo.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4529067830054392459?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4529067830054392459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/01/rosseta-code-tutorialsadd-variable-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4529067830054392459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4529067830054392459'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/01/rosseta-code-tutorialsadd-variable-to.html' title='Rosseta code tutorials:Add a variable to a class instance at run-time'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3347524460199121665</id><published>2011-01-28T03:23:00.000-08:00</published><updated>2012-02-16T08:27:06.962-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena rosseta code'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Rosseta code tutorials:Ackermann function</title><content type='html'>Let's implement Ackermann function - &lt;a href="http://rosettacode.org/wiki/Ackermann_function#Elena"&gt;Rosettacode&lt;/a&gt;.&lt;br /&gt;Because ELENA is a pure object-oriented language we have to create the object which will calculate the function. This object will only evaluates the parameter so we have to declare symbol with the single method "evaluate" (note that a new class can be declared both as implicit symbol - #class MyClass {} and as an explicit one - &lt;br /&gt;#symbol MyClass = { ..}, the only difference that the symbol cannot have fields and be inherited).&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#symbol Ackermann =&lt;br /&gt;{&lt;br /&gt;evaluate &amp;m:anM &amp;n:anN&lt;br /&gt;[&lt;br /&gt;#if (anM == 0)?&lt;br /&gt;[ ^ anN + 1. ].&lt;br /&gt;&lt;br /&gt;#if (anM &gt; 0)?&lt;br /&gt;[&lt;br /&gt;#if (anN == 0)?&lt;br /&gt;[ ^ self evaluate &amp;m:(anM - 1) &amp;n:1. ].&lt;br /&gt;&lt;br /&gt;#if (anN &gt; 0)?&lt;br /&gt;[ ^ self evaluate &amp;m:(anM - 1) &amp;n:(self evaluate &amp;m:anM &amp;n:(anN - 1)). ].&lt;br /&gt;].&lt;br /&gt;&lt;br /&gt;self fail.&lt;br /&gt;]&lt;br /&gt;}.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The implementation is quite straight-forward but there are several things I would like to explain. Any ELENA method has only one parameter but it is still possible to pass several ones using the argument list (which is in fact the single object which returns the expected arguments). The argument names have to be declared beforehand &lt;br /&gt;(see - &lt;a href="http://elenalang.blogspot.com/2011/01/elena-programming-languagemethod.html"&gt;Method calling syntax&lt;/a&gt;). &lt;br /&gt;We may declare the new ones or reuse existing ones from std'dictionary'math module.&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#subject std'dictionary'math'*.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Secondly Ackermann function is defined for n and m bigger or equal to zero. So we have to decide what to do if one of the parameters is negative. ELENA does not support exceptions so we have to break the program flow. It is done by sending the special non-existing message - fail - to itself.&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;self fail.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we could calculate our function:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;'program'Output &lt;&lt; Ackermann evaluate &amp;n:1 &amp;m:1.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Let's modify our code using the appropriate signature (note that &lt;&lt; and write are synonyms):&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;'program'Output write &amp;ackermann &amp;m:0 &amp;n:3.&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To use this signature we have to declare a class with a "signature" hint:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#hint(signature:(ackermann, m, n))&lt;br /&gt;#class AckermanValue&lt;br /&gt;{&lt;br /&gt;#hint(arg:m)&lt;br /&gt;#field theM.&lt;br /&gt;&lt;br /&gt;#hint(arg:n)&lt;br /&gt;#field theN.&lt;br /&gt;&lt;br /&gt;#method m'get = theM.&lt;br /&gt;&lt;br /&gt;#method n'get = theN.&lt;br /&gt;&lt;br /&gt;#method int'get&lt;br /&gt;[&lt;br /&gt;^ Ackermann evaluate:self.&lt;br /&gt;]&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Because a signature should be in the same module as the leading subject we introduce a new one - "ackermann":&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#subject ackermann.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Note that declaring AckermanValue class we do not specify its type (ELENA is actually a type-less language but we could assign a subject to it which can be used as its "type " by multi-dispatching mechanism), so 'program'output will not know how to print it. We have to add a new method to implement a custom print action.&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;#class AckermanValue&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;#hint(disp)&lt;br /&gt;#method save : aWriter&lt;br /&gt;[&lt;br /&gt;aWriter &lt;&lt; self int.&lt;br /&gt;]&lt;br /&gt;&lt;br /&gt;#method __textwriter'save : aWriter&lt;br /&gt;[&lt;br /&gt;aWriter &lt;&lt; "A(" &lt;&lt; theM &lt;&lt; "," &lt;&lt; theN &lt;&lt; ")=" &lt;&lt; self int.&lt;br /&gt;]&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Let's examine these methods. It is presumed that a generic "write" method calls back its parameter. So we have to implement a new method "save". The problem is that actually any writer could call this method. Therefore there should be some conditional statement to check if the parameter is a text writer (subject - __textwriter). It could be achieved with the help of multi-dispatching by marking a generic "save" method with "dispatchable" (or "disp") hint. Now if a parameter is a text writer, "textwriter'save" method will be called instead.&lt;br /&gt;&lt;br /&gt;The expression output will be the following:&lt;br /&gt;&lt;pre style="font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; border: 1px dashed rgb(153, 153, 153); line-height: 14px; padding: 5px; overflow: auto; width: 100%;"&gt;&lt;code&gt;A(0,3)=4&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3347524460199121665?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3347524460199121665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/01/rosseta-code-tutorialsackermann.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3347524460199121665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3347524460199121665'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/01/rosseta-code-tutorialsackermann.html' title='Rosseta code tutorials:Ackermann function'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6045355647870380596</id><published>2011-01-27T08:32:00.000-08:00</published><updated>2011-01-27T08:43:00.880-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>ELENA 1.6.0 released</title><content type='html'>This release includes major language changes (method calling overhaul, simplified message argument list syntax, new classes and several critical bug fixes) as well as refactored ELENA standard library.&lt;br /&gt;&lt;br /&gt;A new concept of method signature is introduces (reusing code, simplifying the message&lt;br /&gt;sending syntax). In general the number of subjects was reduced. For example the subject content is no longer supported. The generic verbs are now used to set / get indexer / variable content.&lt;br /&gt;1.5.6:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anArray@3 content'set:anObject&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;1.6.0:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anArray@3 indexer set:anObject&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The subject bool was removed as well. Compare:&lt;br /&gt;1.5.6:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#if (anInteger &gt;= -2147483646)bool'or:(anInteger &lt;= 2147483647)?&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;1.6.0:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#if (anInteger &gt;= -2147483646)or:(anInteger &lt;= 2147483647)?&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I will post several tutorials describing 1.6.x features.&lt;br /&gt;&lt;br /&gt;http://sourceforge.net/projects/elenalang/files/ELENA/1.6.0/ELENA-1.6.0.zip/download&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6045355647870380596?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6045355647870380596/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/01/elena-160-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6045355647870380596'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6045355647870380596'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/01/elena-160-released.html' title='ELENA 1.6.0 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4702374869086447697</id><published>2011-01-15T05:48:00.000-08:00</published><updated>2011-01-15T05:52:55.862-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><category scheme='http://www.blogger.com/atom/ns#' term='multi dispatching'/><title type='text'>ELENA Programming Language:method calling syntax</title><content type='html'>In this post I would like to make a short overview of ELENA method syntax features (starting from 1.5.6.9 version).&lt;br /&gt; &lt;br /&gt;ELENA programming language (unlike many others) introduces several limitation on the programmer free will over naming and using methods. First of all the method can have only one parameter. Secondly there are special rules how the method could be named (apart from private ones, which we will ignore in this post).&lt;br /&gt;&lt;br /&gt;The simplest method declaration may look like this (in case of in-line class, the keyword is omitted):&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#method subject'verb : parameter&lt;br /&gt;[&lt;br /&gt;]&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you see the method name consists of two parts: a subject (a noun) and a verb. The verb defines an expected operation, the subject describes a method parameter (a list of possible operations with it).&lt;br /&gt;If the message do not have a subject part it is considered to be generic (and can be used for multi-dispatching). The 'GET' messages may omit their verbs. The following expressions are equivalent: “aNumber int'get” and “aNumber int” (“int” is a subject).&lt;br /&gt;&lt;br /&gt;There are a limited list of verbs in ELENA (though this lists will be expanded with the time, to avoid possible verb overuse). Let's name them:  add, and, append, back, check, clear, clone, close, delete, dispatch, divide, do, equal, evaluate, find, free, get, greater, if, ifequal, ifless, ifnot, increase, insert, is, isnot, less, load, multiply, new, not, notequal, notgreater, notless, open, or, proceed, process, react, read, reduce, repeat, rewind, run, save, send, separate, set, start, stop, subtract, wait, write, xor.&lt;br /&gt;&lt;br /&gt;There are  synonyms (operators) for some verbs. Unlike normal verbs, operators have lower parsing order. These codes are equivalent - “a &lt;&lt; b + c int'get” and “a write:(b add:(c int'get))”. Operatiors are generic verbs and cannot have subjects. Let's name the operators and their verbs: &lt;br /&gt;== - equal, &lt;br /&gt;!= - notequal,&lt;br /&gt;&gt;= - notlesss,&lt;br /&gt;&lt;= - notgreater,&lt;br /&gt;&gt; - greater,&lt;br /&gt;&lt; - less,&lt;br /&gt;? - is,&lt;br /&gt;! - isnot,&lt;br /&gt;@ - seek,&lt;br /&gt;=&gt; - evaluate,&lt;br /&gt;&gt;&gt; - read,&lt;br /&gt;&lt;&lt; - write,&lt;br /&gt;+ - add,&lt;br /&gt;- - subtract,&lt;br /&gt;* - multiply,&lt;br /&gt;/ - divide,&lt;br /&gt;+= - append,&lt;br /&gt;-= - reduce,&lt;br /&gt;*= - increase,&lt;br /&gt;/= - separate&lt;br /&gt;&lt;br /&gt;Unlike verbs the subject names are not limited (it is not recommended to give a name equal to a verb, because of possible ambiguity). But the subject should be declared before the use. The syntax looks like this:&lt;br /&gt;#subject subject, argument1, argument2.&lt;br /&gt;&lt;br /&gt;It is possible to import subjects declared in another packages (the subjects declared in the project are automatically imported in all following modules).&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#subject math'dictionary'*.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If there is a name conflicts between subjects declared in different modules it is possible to provide an alias (will be implemented in 1.6.0).&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#subject math'* = math'dictionary'*.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It is possible to import the subjects to the whole project (std'dictionary, std'dictionary'protocols, std'dictionary'types subjects are imported automatically to any program or library).&lt;br /&gt;&lt;br /&gt;Though the method may have only one parameter it is still possible to provide several arguments with the help of argument objects. Let's consider how we could declare the method with an argument list.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#method subject'verb &amp;argument1:anArgument1 &amp;argument2:anArgument2&lt;br /&gt;[&lt;br /&gt;]&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code will be compiled into the following:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#method subject'verb  : anArguments&lt;br /&gt;[&lt;br /&gt; #var anArgument1 := anArguments argument1'get.&lt;br /&gt; #var anArgument2 := anArguments argument2'get.&lt;br /&gt;]&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The similar syntax could be used for passing multiple arguments to the method (note that it doesn't matter if the method declaration uses an argument list).&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anObject subject'verb &amp;argument1:anArg1 &amp;argument2:anArg2.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This code will be compiled into the following:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anObject subject'verb: { argument1'get = anArg1. argument2'get = anArg2 }.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As it was already said above the subject defines the method parameter. This feature is used in ELENA for implementing multi-dispatching.&lt;br /&gt;&lt;br /&gt;Let's declare three classes A, B, C and assigns subject1 to the class A, subject2 to the class B (class C does not have assigned subject).&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#hint(subj:subject1)&lt;br /&gt;#class A&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#hint(subj:subject2)&lt;br /&gt;#class B&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#class  C&lt;br /&gt;{&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we will declare the fourth class which will deal with them.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#class D&lt;br /&gt;{&lt;br /&gt; #method subject1'set : anObject [ … ]&lt;br /&gt;&lt;br /&gt; #method subject2'set : anObject [ … ]&lt;br /&gt;&lt;br /&gt; #method set : anObject [ … ]&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;We are going to call the verb set with instances of classes A, B and C. According to our notation for the instance of the class A we have to call subject1set, for an instance of B – subject2'set. Because the class C does not have an subject we should call generic method set (it is expected that the generic methods are able to work with “unknown” objects). So lets declare three variables and call the appropriate methods.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#var anA := A.&lt;br /&gt;#var aB := B.&lt;br /&gt;#var aC := C.&lt;br /&gt;&lt;br /&gt;D subject1'set:anA subject2'set:aB set:aC.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;But in most cases we do not know its type (in ELENA its class or supported subject). It is possible dynamically resolve the appropriate message. Let's add a special attribute to the generic method.&lt;br /&gt; &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt; #hint(disp)&lt;br /&gt; #method set : anObject [ … ]&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we could simplify the code and the appropriate message will be called automatically&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;D set:anA set:aB set:aC.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And finally let's consider the concept of an argument signature. A signature allows to define the message subject on the base of argument list (static multi-dispatching).&lt;br /&gt;&lt;br /&gt;Let's presume we have a  following argument list&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#method subject'set &amp;argument1:anArg1 &amp;argument2:anArg2 &amp;argument3:anArg3 […]&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Instead of passing every time all three arguments we could define three alternative argument signature: &amp;argument1 &amp; argument2, &amp;argument2 &amp; argument3 and &amp;argument1 &amp; argument3.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#hint(subj:subject, signature:(argument1, argment2), signature:(argument2, argment3), signature:(argument1, argment3))&lt;br /&gt;#class CustomArgumentList&lt;br /&gt;{&lt;br /&gt; #hint(arg:argument1)&lt;br /&gt; #field theArg1.&lt;br /&gt;&lt;br /&gt; #hint(arg:argument2)&lt;br /&gt; #field theArg2.&lt;br /&gt;&lt;br /&gt; #hint(arg:argument3)&lt;br /&gt; #field theArg3.&lt;br /&gt;&lt;br /&gt; #method argument1'get = theArg1 nil'isnot | back:0.&lt;br /&gt;&lt;br /&gt; #method argument2'get = theArg2 nil'isnot | back:0.&lt;br /&gt;&lt;br /&gt; #method argument3'get = theArg3 nil'isnot | back:0.&lt;br /&gt;}&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;(Note that the signature class, should be declared in the same module where the first argument is declared). The mapping between argument value and a signature class field is defined by arg hint.&lt;br /&gt;&lt;br /&gt;So now we could use simplified syntax to call  subject'set&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anObject set &amp;argument1:anArg1 &amp;argument2:anArg2.&lt;br /&gt;anObject set &amp;argument2:anArg2 &amp;argument3:anArg3.&lt;br /&gt;anObject set &amp;argument1:anArg1 &amp;argument3:anArg3.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Note that the order of the argument subjects play important role. &amp;argument2 &amp;argument1 and argument1 &amp;argument2 are different signatures.&lt;br /&gt;&lt;br /&gt;If the argument list contains only one argument it will be automatically translated into an appropriate message.&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;anObject argument1'set:aParam and anObject set &amp;argument1:aParam are equivalent.&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The signature cannot be used in the method declaration. If no appropriate signature can be found the generic method will be called.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4702374869086447697?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4702374869086447697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/01/elena-programming-languagemethod.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4702374869086447697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4702374869086447697'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/01/elena-programming-languagemethod.html' title='ELENA Programming Language:method calling syntax'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6758216086274267440</id><published>2011-01-14T12:11:00.000-08:00</published><updated>2011-01-14T12:37:45.141-08:00</updated><title type='text'>Weekly release: 1.5.6.9</title><content type='html'>1.5.6.9 is a snapshot of the work on upcoming major 1.6.0 release. Part of the code was not yet ported to the new platform. Nevertheless it includes all major improvement designed for 1.6.0.&lt;br /&gt;&lt;br /&gt;The main change of the coming release is an improved argument syntax. Let's compare -&lt;br /&gt;1.5.6.4:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;'program'Output &lt;&lt; &lt;br /&gt;      translit'Transliteration::translit'RusLat run:aSource &lt;&lt; "%n%n".&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;1.5.6.9:&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;'program'Output write &amp;amp;_cyril2lat &amp;amp;literal:aSource &lt;&lt; "%n%n".&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;“&amp;amp;_cyril2lat &amp;amp;literal:aSource” - is called argument signature and allows to reuse the code.&lt;br /&gt;For example we could use the same signature in another method without any change in basic'String code – &lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;basic'String append &amp;amp;_cyril2lat &amp;amp;literal:aSource&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;In the next posts I will discuss it in details&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6758216086274267440?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6758216086274267440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2011/01/weekly-release-1569.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6758216086274267440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6758216086274267440'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2011/01/weekly-release-1569.html' title='Weekly release: 1.5.6.9'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-8611144943932292258</id><published>2010-12-24T12:49:00.001-08:00</published><updated>2010-12-24T12:51:39.888-08:00</updated><title type='text'>Up'N'Down 0.1 is released</title><content type='html'>After more then two years I managed to release the first version of Up'N'Down game, the first "real" program written with ELENA.&lt;br /&gt;&lt;br /&gt;http://sourceforge.net/projects/upndown/files/0.1/upndown-bin-0.1.zip/download&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-8611144943932292258?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/8611144943932292258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/12/upndown-01-is-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8611144943932292258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8611144943932292258'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/12/upndown-01-is-released.html' title='Up&apos;N&apos;Down 0.1 is released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-1404133457905252579</id><published>2010-12-20T04:19:00.000-08:00</published><updated>2010-12-20T04:36:35.996-08:00</updated><title type='text'>Weekly release: 1.5.6.4</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-weight: bold;"&gt;There were several critical bug fixes (disabled debug mode crashes executable file, cirtical fix in $next keyword implementing, cirtical fix in the long integer constant implementation), a new class std'collections'dictionary and some minor changes in the language itself.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;First, I'm continuing to re-factor ELENA API code. As you probably know the language features some formal rules regarding the method names. They consist of subject and verb. The number of verbs are limited and should be well-defined. As it appeared there is a two ambiguous verbs - do and run. So starting from 1.5.6.3 the code review is proceeding and as a result some of subjects were dropped (like literalinfo, memoryinfo and so on). The main goal is to make sure that the subject defines the method parameter (with exception for 'do' verb) rather then the operation. Another goal is to make sure that the subjects are reusable (which is not the case for the subject like literalinfo).&lt;br /&gt;&lt;br /&gt;Second bug change deals with operators. The operators are normal methods with custom parsing order. The expression '2 + 3 * a int'  is parsed like 2 + (3 * (a int)).&lt;br /&gt;Because of they nature it was not possible to provide the operator with the subject.&lt;br /&gt;As a result the use of operators was limited. Starting from 1.5.6.4 the operators are synonyms to 'normal' verbs:&lt;br /&gt;   '==' &lt;=&gt; 'equal'&lt;br /&gt;   '!=' &lt;=&gt; 'notequal&lt;br /&gt;   '+' &lt;=&gt; add&lt;br /&gt;   '?' &lt;=&gt; is&lt;br /&gt;&lt;br /&gt;and so on.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-1404133457905252579?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/1404133457905252579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/12/weekly-release-1564.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1404133457905252579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1404133457905252579'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/12/weekly-release-1564.html' title='Weekly release: 1.5.6.4'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7452555834907728722</id><published>2010-12-09T04:36:00.000-08:00</published><updated>2010-12-09T15:24:10.617-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena y project'/><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>ELENA Programming Language: The Next Big Thing</title><content type='html'>&lt;div style="text-align: justify;"&gt;I've started the project more than 10 years ago. I've made a decision to create my one language in the summer of 1999. I had a quite  vague idea what it would be except the idea that it will be a pure object-oriented  language with late binding (dynamic one). So at first I was occupied with technical tasks implementing the compiler. The syntax was not important (due to a LALR parser which gave me total freedom over it). Compiler-free linker was created and since that I was able to concentrate on the language itself. ELENA is a frame language actually, it doesn't implement the "real" code (like adding numbers, comparing strings and so on). So I was free from this as well and concentrated on experiments with different language models (still in object-oriented frames). In 2006 I published the project on the sourceforge site and since that the work was accelerated. In 2007 the modern-like syntax was introduced. In 1.2.0 (2008) the first dynamic features were introduced (context-dependant roles). In 1.2.5 the dynamic inheritance was introduced. The latest version 1.5.6 introduced the final version of method calling routine (subjects and verbs). So what will be a next big thing?&lt;br /&gt;&lt;br /&gt;Starting from 1.5.7 I will start so-called "y project". It's main goal is to create a special meta language which will be a high level abstraction script for the language virtual machine (elenavm). Unlike "traditional" scripts it will be not imperative. In ideal case it should be set of instructions how to assemble (self-assemble) the set of objects (symbols in ELENA terms) which will be able to solve the problem (objects themselves are written in normal way). The test bed will be opencalc sample. With the help of vmconsole  the programmer will be able to interact with the system by entering the script (actually recombining existing ones).&lt;br /&gt;&lt;br /&gt;One could say, is it real or just a pipe dream? At the current moment it is hard to say. It is actually a manifest or declaration of intent. The direction I'm going to work on. But I hope the first result (probably very early) will be already seen in the 1.5.7 release. Time will say&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7452555834907728722?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7452555834907728722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/12/elena-programming-language-next-big.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7452555834907728722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7452555834907728722'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/12/elena-programming-language-next-big.html' title='ELENA Programming Language: The Next Big Thing'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4827197335671823535</id><published>2010-12-04T16:18:00.000-08:00</published><updated>2010-12-04T16:37:00.741-08:00</updated><title type='text'>Weekly release: 1.5.6.3</title><content type='html'>What's new since 1.5.6.1:&lt;br /&gt;&lt;br /&gt;1.5.6.2&lt;br /&gt;&lt;br /&gt;- changed inline class implementation&lt;br /&gt;- new symbol ext'io'TextReading&lt;br /&gt;- fixed std'basic'memory:bugs with memory operations&lt;br /&gt;- fixed critical bug with long number constant&lt;br /&gt;- new project template - guivm&lt;br /&gt;- new : std'patterns'Validation symbol&lt;br /&gt;- new : sys'groups'StaticBroadCaster&lt;br /&gt;- dynamic symbol loading&lt;br /&gt;- new symbol sys'vm'loader&lt;br /&gt;&lt;br /&gt;1.5.6.3&lt;br /&gt;- drop support of streamable subject&lt;br /&gt;- fixed matrix sample&lt;br /&gt;- enum verb is obsolete, use run&lt;br /&gt;- indexerloop symbol is obsolete - use index&lt;br /&gt;- loop subject is obsolete&lt;br /&gt;- new verb:rewind&lt;br /&gt;- control-evaluate should be used intead of control-run&lt;br /&gt;- control-run / control-rewind repeats the action while the result is true / false&lt;br /&gt;- canvas: possible to select color and font&lt;br /&gt;&lt;br /&gt;It is now possible to load dynamically symbols by their name (for vm clients)&lt;br /&gt;&lt;br /&gt;Starting with 1.5.6.3 the work on ELENA API refactoring is started. The main focus would be methods named like xx'run and xx'do. At the moment there are too many such names.&lt;br /&gt;&lt;br /&gt;As I wrote before ELENA introduces an original concept of method naming. Unlike many other languages the language proposes a formal rule for method naming. The normal method name consists of the subject and the verb. As it appeared there are too many methods with subject which in fact a gerund rather then a noun. So I will rename such methods to make the subjects more resusable. And some form of subject morphology is introduced: [subject]&lt;subject&gt;+ing  &lt;=&gt;&lt;/subject&gt;[subject]&lt;subject&gt; &lt;subject&gt; + for + action (e.g. range and ranging, list and listing).&lt;br /&gt;&lt;br /&gt;So bsort sample is changed:&lt;br /&gt;1.5.6.2:&lt;br /&gt; - ctrl'IndexerLoop backwardloop'run &amp;amp;from:aLastIndex &amp;amp;till:0 &amp;amp;for:anArray &amp;amp;action:&lt;br /&gt;1.5.6.3 (a new verb rewind):&lt;br /&gt; - ctrl'IndexIterator ranging'rewind &amp;amp;for:anArray &amp;amp;till:aLastIndex &amp;amp;action&lt;br /&gt;&lt;br /&gt;1.5.6.2:&lt;br /&gt; - ctrl'IndexEnum loop'run &amp;amp;for:anArray &amp;amp;action:&lt;br /&gt;1.5.6.3:&lt;br /&gt; - ctrl'IndexEnum listing'run &amp;amp;for:anArray &amp;amp;action:&lt;br /&gt;&lt;br /&gt;The subject loop is obsolete ( it is in fact a process rather then an object )&lt;/subject&gt;&lt;/subject&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4827197335671823535?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4827197335671823535/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/12/weekly-release-1563.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4827197335671823535'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4827197335671823535'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/12/weekly-release-1563.html' title='Weekly release: 1.5.6.3'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-5659350508139224440</id><published>2010-11-08T09:23:00.001-08:00</published><updated>2010-11-08T09:28:39.403-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><title type='text'>Weekly release: 1.5.6.1</title><content type='html'>I spent the last week fixing number of bugs, including several critical ones:&lt;br /&gt;- fixed the issue with the focus in upndown sample&lt;br /&gt;- fixed int64 division&lt;br /&gt;- fixed int64 subtraction&lt;br /&gt;- add possibility to import subjects on the level of the module&lt;br /&gt;- critical bug with nested conditional statements&lt;br /&gt;- critical bug with GC&lt;br /&gt;&lt;br /&gt;Most of the work was done with upndown sample which is now more stable. I plan to release the first alpha version of the game during the current month&lt;br /&gt;&lt;br /&gt;x-project reached a significant milestone: young generation garbage collection routine is tested for console applications, next will be gui ones. After that I will start to implement multi-threading routine&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-5659350508139224440?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/5659350508139224440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/11/weekly-release-1561.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5659350508139224440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5659350508139224440'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/11/weekly-release-1561.html' title='Weekly release: 1.5.6.1'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3707891824706476412</id><published>2010-10-29T01:36:00.000-07:00</published><updated>2010-10-29T01:39:33.093-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='new programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented'/><title type='text'>ELENA 1.5.6 released</title><content type='html'>What's new in 1.5.6&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;Despite my promise in the previous post I released a new  version early and it is a major one.  Once again the method calling routine was overhauled.&lt;br /&gt;So what's the point of it? After the subject concept was introduced the number of subjects increased at very high speed. Practically any new functionality brought new subjects as well. So I realized that proposed solution is not ideal and there is a question of subject reusing. So the next step was to start to use it for different patterns. But this contradicted with the original goal of subjects - to prevent possible name conflicts. As a result I separated  generic subjects from domain oriented. Instead of "aControl control'items" I use "aControl control items" (where items is a generic subject and control is a part of gui dictionary). Thus the code was simplified (both compiler and source ones) and several ideas were dropped (property, nested subjects and so on).&lt;br /&gt;Another very important change deals with nil'ifnot. Actually "if" or "ifnot" verbs require a parameter. "is" does not need is. So Instead of "nil'ifnot" - "nil'if" is used (and this is more logical than the previous message, only nil symbol should support it)&lt;br /&gt;And of course all these changes broke the compatibility with the previous versions (but I hope this will not require any significant efforts).&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Here the comparison between 1.5.5.x and 1.5.6 code samples:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;aControls @ connector'SecondPlayerID control'items control'selected'index'set:0. &lt;/li&gt;&lt;li&gt;aControls @ connector'SecondPlayerID items selected'set:0.&lt;/li&gt;&lt;/ul&gt;Or&lt;br /&gt;&lt;ul&gt;&lt;li&gt;#var aPlayerInfo := aControl control'items control'selected control'tag.&lt;/li&gt;&lt;li&gt;#var aPlayerInfo := aControl items selected tag.&lt;/li&gt;&lt;/ul&gt;Or&lt;br /&gt;&lt;ul&gt;&lt;li&gt;#if aValue nil'ifNot [self write:aValue. ].&lt;/li&gt;&lt;li&gt;#if aValue nil'is | [self write:aValue. ].&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3707891824706476412?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3707891824706476412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/10/elena-156-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3707891824706476412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3707891824706476412'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/10/elena-156-released.html' title='ELENA 1.5.6 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7446107765830833339</id><published>2010-10-21T15:58:00.000-07:00</published><updated>2010-10-21T16:05:11.153-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><title type='text'>1.5.5.11 weekly release</title><content type='html'>1.5.5.11 release is out now.&lt;br /&gt;&lt;br /&gt;There are several enhancement over method calling: it is now possible to use nested secondary subjects, #property keyword is introduced (yet not fully tested).&lt;br /&gt;&lt;br /&gt;Several major bugs were fixed, including&lt;br /&gt;#00057 (read a long string from the console) and a one with 64bit integer constants.&lt;br /&gt;&lt;br /&gt;Small changes in ELENA API: ctrl'IndexBackwarding is no longer supported, a new symbols - std'patterns'Loop, std'patterns'IndexLoop, std'patterns'IndexBackLoop and std'patterns'IndexerLoop should be used&lt;br /&gt;&lt;br /&gt;Work on linux migration and x-project is continued&lt;br /&gt;&lt;br /&gt;A major release is sheduled on mid of novermber ( actually it will be one of normal weekly release ).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7446107765830833339?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7446107765830833339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/10/15511-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7446107765830833339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7446107765830833339'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/10/15511-weekly-release.html' title='1.5.5.11 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-8176396700431505197</id><published>2010-10-12T13:34:00.000-07:00</published><updated>2010-10-12T13:53:39.880-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>1.5.5.10 weekly release</title><content type='html'>ELENA 1.5.5.10 is out.&lt;br /&gt;&lt;br /&gt;The release features a new control - gui'controls'Menu ( look at notepad sample to learn how to use it ).&lt;br /&gt;&lt;br /&gt;Several new methods were added:&lt;br /&gt;  - std'collections'List&lt;br /&gt;         * clear - clears the list;&lt;br /&gt;  - win32'controls'edit / win32'controls'memo&lt;br /&gt;         * edit'selection'get - returns the edit cursor position and the selection length&lt;br /&gt;         * edit'selection'set - sets the edit cursor position and the selection length&lt;br /&gt;&lt;br /&gt;    For example&lt;br /&gt;      #var aPosition := theEdit edit'selection edit'selection'starting. // the cursor position&lt;br /&gt;      #var aSelection := theEdit edit'selection edit'selection'length. // the selection length or 0 if the text is not selected.&lt;br /&gt;&lt;br /&gt;A #00056 bug is fixed: when the default encoding is unicode there were problems with ansi files&lt;br /&gt;&lt;br /&gt;ELENA Project code is moved to gcc4 (it took me some time before I was able to compile the code, I even started to think over moving to MSVS Express)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-8176396700431505197?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/8176396700431505197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/10/15510-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8176396700431505197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/8176396700431505197'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/10/15510-weekly-release.html' title='1.5.5.10 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7500944979649004357</id><published>2010-10-04T06:36:00.000-07:00</published><updated>2012-02-16T08:26:42.123-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>Method Calling tutorial</title><content type='html'>&lt;div style="text-align: justify;"&gt;From the first programming languages procedures (or functions) play very important role. Introduction of object-oriented paradigm increase this role even more. So it is not possible to program a language without learning the way how it handles procedures. This tutorial will show that this is not so trivial in ELENA.&lt;br /&gt;&lt;br /&gt;When ELENA programming language was designed I made an important decision - to limit the number of method parameters to just one (concept of the limited object interface). It was done to make the object interface (or protocol if you wish) as much polymorphic as possible (selecting one set of parameters over others implies the way how it will be used; anyone who tried to add another method with the same name in the C++ base class knows that it could be a painful process).&lt;br /&gt;&lt;br /&gt;So how String.Insert(index, value) method could be implemented if you cannot provide another parameter? There are general several ways how to do this. First way would be to introduce a special class (in this case std'basic'LiteralIndexer) which will be a mediator (agent) between string and the piece of code where the substring is inserted. So in ELENA it will look like this anStr@index insert:value ( @ operator will return an indexer pointing to specified position). One good thing with this that it is a code pattern. So every time we would like to insert something into an indexable collection we will use this way. But sometimes we have to set several peer parameters (like x and y coordinates). Of course we could set them independently but if it is important to set them simultaneously the second way could be used - aControl location'set: { location'x = 20. location'y = 20. }. The good thing is that location'set is a polymorphic method ( no change in  the method interface have to be made if we decided to use three-dimensional or polar coordinates). The bad thing that the expression is quite big. So a special simplified version could be used - aControl location'set &amp;amp;x:20 &amp;amp;y:20.  If the method requires no parameters a special nil symbol is passed to it - aControl control'open ( &lt;=&gt; aControl control'open:nil).&lt;br /&gt;&lt;br /&gt;Being dynamic ELENA does not allow to implement a method overload a la C++. Instead the polymorphic nature of method parameter can be used. For example std'patterns'IndexEnum::pattern'run could use two set of parameters -  ctrl'IndexEnum &amp;amp;for:anArray &amp;amp;action: =&gt; [ .. ] and ctrl'IndexEnum &amp;amp;from:anArray@2 &amp;amp;action: =&gt; [ ... ]. std'basic' LiteralIndexer :: literalinfo'create method is another example. If we would like to copy a substring from the specific position till the end we could omit parameter at all - aStr@2 literalinfo'create. If we wish to provide a substring length - aStr@2 literalinfo'create &amp;amp;length:10. If we are interested in copying a substring from one indexer till another - aStr@0 literalinfo'create &amp;amp;till:(aStr@1 literal'seek:" ").&lt;br /&gt;&lt;br /&gt;Note that in all examples above a single method body was used. If we need a specific implementation for different parameters multi-dispatching routine should be used. In ELENA multi-dispatching is similar to traditional polymorphism with the only difference that executing code depends on a parameter rather than the object. For example if the method parameter is an integer - an integer operation should be executed. If it is a real number - real one and so on. e.g. - aWriter write:2 write:2.3r write:"literal" should correctly write to the stream an integer, a real and a literal values.&lt;br /&gt;&lt;br /&gt;How could we achieve this on the language with the late binding (no compiler magic like in static languages)? Several ways could be used. One of them would be to ask the parameter to do the operation itself (after all who knows how to handle the object better than the object itself?). The problem with these approach (which is used in ELENA as well) that the object should know all possible operation with it. In ELENA a method naming limitation makes the things even worse (It is not possible to call the method copyToInteger, lessThenInteger as it would be discussed later). So as an alternative the concept of the subject was introduced.&lt;br /&gt;&lt;br /&gt;The subject could be considered as a declarative type (a unique token). For example std'basic'Literal, std'basic'String and gui'control'Edit are all implement literal subject (note that they do not share common code with each other except a generic super class). The subject should be declared before use. It is inherited but the class may support only one subject (it is done with a special compiler hint - #hint[subj:literal] before a class or symbol declaration).&lt;br /&gt;&lt;br /&gt;Before continuing let's consider another topic where a subject is used - method naming. As opposed to many main stream languages ELENA limits the way how a method can be named. Any public message may consist of subject and verb (generic messages have only verb part of the name). The number of verbs are limited and well defined (e.g. and, get, set, read, write, start, run and so on). The subject is defined by the user and could represent an actor or type (bool'and, int'add, literal'read, indexer'get; see above). The subject may represent the process as well (pattern'run, process'start and so on).&lt;br /&gt;&lt;br /&gt;So let's return to multi-dispatching mechanism. If our class (stream writer for example) handles a particular subject (integer, real or literal values) the method name should contain the appropriate subject (int'write, real'write and literal'write). This approach allows the object to notify any potential user of expecting parameter type (note that in a language with late binding like ELENA the mismatch type errors can be found only in run-time) or returning value (literal'get) or expected operation - (process'stop). As a plus this helps us with multi-dispatching as well. If we mark our class as dispatchable (#hint[dispatchable]) when the expression aWriter write:2 write:2.3r write:"literal" will actually invoke int'write, real'write and literal'write respectively.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7500944979649004357?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7500944979649004357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/10/method-calling-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7500944979649004357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7500944979649004357'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/10/method-calling-tutorial.html' title='Method Calling tutorial'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6994793396025565975</id><published>2010-10-02T17:06:00.000-07:00</published><updated>2010-10-02T18:31:18.741-07:00</updated><title type='text'>1.5.5.9 weekly release</title><content type='html'>After a false start, ELENA 1.5.5.9 is out.&lt;br /&gt;&lt;br /&gt;This release contain a new sample notepad which uses a new class gui'common'LayoutManager designed to auto adjust control location when the form is resized. &lt;br /&gt;&lt;br /&gt;on'resize event is now raised after the control size is changed.&lt;br /&gt;&lt;br /&gt;The work on linux migration and x project continued&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6994793396025565975?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6994793396025565975/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/10/1559-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6994793396025565975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6994793396025565975'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/10/1559-weekly-release.html' title='1.5.5.9 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-2031919079860782669</id><published>2010-09-25T11:05:00.000-07:00</published><updated>2010-09-25T11:24:51.081-07:00</updated><title type='text'>1.5.5.8 weekly release</title><content type='html'>A new weekly version is out now.&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;The work on upndown, dtcalculator and eldoc samples continues.&lt;br /&gt;&lt;br /&gt;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').&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;&lt;br /&gt;I modified textfile reader implementation. The reader no longer returns trailing %r%n characters.&lt;br /&gt;&lt;br /&gt;New methods:&lt;br /&gt;  std'patterns'indexenum search'run &amp;from &lt;br /&gt;      (e.g ctrl'indexenum search'run &amp;from:a@3 &amp;value:b &lt;br /&gt;       - compare with ctrl'indexenum search'run &amp;for:a &amp;value:b)&lt;br /&gt;&lt;br /&gt;  sts'basic'literalindexer literalinfo'create &amp;till&lt;br /&gt;      (e.g a@i literalinfo'create &amp;till:a@j &lt;br /&gt;       - compare with a@i literalinfo'create &amp;length:(j - i))&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-2031919079860782669?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/2031919079860782669/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/1558-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2031919079860782669'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/2031919079860782669'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/1558-weekly-release.html' title='1.5.5.8 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3411138068591215112</id><published>2010-09-20T06:02:00.000-07:00</published><updated>2012-02-16T08:28:33.640-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='know how'/><category scheme='http://www.blogger.com/atom/ns#' term='tutorial'/><title type='text'>ELENA Programming Language: Object model</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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).&lt;br /&gt;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).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3411138068591215112?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3411138068591215112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/elena-programming-language-object-model.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3411138068591215112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3411138068591215112'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/elena-programming-language-object-model.html' title='ELENA Programming Language: Object model'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4585423735880149063</id><published>2010-09-19T04:29:00.000-07:00</published><updated>2010-09-19T04:45:38.492-07:00</updated><title type='text'>1.5,5,7 weekly release</title><content type='html'>Several new symbols were added to ELENA API:&lt;br /&gt;sys'io: BinaryFile, NewBinaryFile&lt;br /&gt;ext'text: HexAdapter, EIntFormatter, ELiteralFormatter&lt;br /&gt;&lt;br /&gt;BinaryFile and NewBinaryFile are adapters to work with binary files.&lt;br /&gt;&lt;br /&gt;#var reader := BinaryFile::"file.dat" reader'get.&lt;br /&gt;#var writer := NewBinaryFile::"newfile.dat" writer'get.&lt;br /&gt;&lt;br /&gt;Returned reader and writer support basic reader / writer protocol to work with data.&lt;br /&gt;&lt;br /&gt;HexAdapter will allow to convert hexadecimal literal constant to the integer and back:&lt;br /&gt;#var S := ext'text'HexAdapter literal'of:2Dh. // -&gt; "2D"&lt;br /&gt;#var N := ext'text'HexAdapter int'of:S. // -&gt; 2D&lt;br /&gt;&lt;br /&gt;The work on upndown example continues. It is now possible to play basic rounds (without joker).&lt;br /&gt;&lt;br /&gt;New binary corex.bin will contain an enhanced GC implementation supporting multi-threading.&lt;br /&gt;&lt;br /&gt;Some settings were moved from elc.cfg to the specific templates (like console.cfg)&lt;br /&gt;&lt;br /&gt;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.&lt;br /&gt;&lt;br /&gt;I'm planning to start my first real open architecture application - opencalc.&lt;br /&gt;&lt;br /&gt;So that's all for this week&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4585423735880149063?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4585423735880149063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/1557-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4585423735880149063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4585423735880149063'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/1557-weekly-release.html' title='1.5,5,7 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-7036545784674068142</id><published>2010-09-07T05:25:00.000-07:00</published><updated>2010-09-07T05:26:24.161-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='group object'/><title type='text'>ELENA Programming Language: Paradigm</title><content type='html'>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).&lt;br /&gt;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.&lt;br /&gt;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.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-7036545784674068142?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/7036545784674068142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/elena-programming-language-paradigm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7036545784674068142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/7036545784674068142'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/elena-programming-language-paradigm.html' title='ELENA Programming Language: Paradigm'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-5653918549243299597</id><published>2010-09-03T11:21:00.000-07:00</published><updated>2010-09-03T11:27:18.855-07:00</updated><title type='text'>1.5,5,4 weekly release</title><content type='html'>A new version is available - 1.5.5.4&lt;br /&gt;&lt;br /&gt;It contains mostly ELENA API bug fixes and a new symbol - gui'dialogs'errorbox&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-5653918549243299597?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/5653918549243299597/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/1554-weekly-release.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5653918549243299597'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5653918549243299597'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/1554-weekly-release.html' title='1.5,5,4 weekly release'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-3152384437960002758</id><published>2010-09-02T02:35:00.000-07:00</published><updated>2010-09-02T02:53:55.140-07:00</updated><title type='text'>Method calling in ELENA: overhaul, part 2</title><content type='html'>&lt;div style="text-align: justify;"&gt;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 &lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/Weekly"&gt;http://sourceforge.net/projects/elenalang/files/ELENA/Weekly&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The first such weekly release happened yesterday - &lt;a href="http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/elena-1.5.5.3.zip/download"&gt;http://sourceforge.net/projects/elenalang/files/ELENA/Weekly/elena-1.5.5.3.zip/download&lt;/a&gt;&lt;br /&gt;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 - &lt;span&gt;self set &amp;amp;gui'location'x:50 &amp;amp;y:50 set &amp;amp;gui'size'width:700 &amp;amp;height:520 gui'control'caption'set:"Caption"&lt;/span&gt; - will look a bit better -&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-weight: bold;"&gt;self location'set &amp;amp;x:50 &amp;amp;y:50 size'set &amp;amp;width:700 &amp;amp;height:520 control'caption'set: "Caption"&lt;/span&gt;.&lt;br /&gt;&lt;/div&gt;The same for event handler - on'control'Click'do has to be converted to on'Click'do.&lt;br /&gt;&lt;br /&gt;Here the list of changes:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;LiteralType and ArrayType "create" methods are now obsolete. &lt;span style="font-weight: bold;"&gt;LiteralType literalinfo'create &amp;amp;length and ArrayType arrayinfo &amp;amp;count&lt;/span&gt; should be used instead. If you wish to initialize the array during its creation you should use the same method - &lt;span style="font-weight: bold;"&gt;basic'ArrayType arrayinfo'create &amp;amp;count:10 &amp;amp;action: =&gt; (basic'Integer &amp;lt;&amp;lt;0)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;ctrl'IndexEnum run &amp;amp;enum'in &amp;amp;action and ctrl'Enum run &amp;amp;enum'in &amp;amp;action are no longer supported - &lt;span style="font-weight: bold;"&gt;ctrl'IndexEnum pattern'run&amp;amp;for &amp;amp;action&lt;/span&gt; and c&lt;span style="font-weight: bold;"&gt;trl'Enum pattern'run&amp;amp;for &amp;amp;action&lt;/span&gt; should be used instead.&lt;/li&gt;&lt;li&gt;gui'control'items'get =&gt; &lt;span style="font-weight: bold;"&gt;control'items'get&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Event handlers "on'control'Paint'do" and " control'IndexChanged'do " should be converted into -&lt;span style="font-weight: bold;"&gt; on'Paint &amp;amp;canvas&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;on'IndecChanged &amp;amp;index&lt;/span&gt;&lt;/li&gt;&lt;li&gt;ext'patterns'ArrayType is no longer supported. Use &lt;span style="font-weight: bold;"&gt;std'basic'ArrayType&lt;/span&gt; instead&lt;/li&gt;&lt;li&gt;ext'io'textfile and ext'io' LogTextFile are no longer supported. They were moved into sys package. So use&lt;span style="font-weight: bold;"&gt; sys'io'textfile&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;sys'io' LogTextFile&lt;/span&gt;&lt;/li&gt;&lt;li&gt;std'patterns'Loop is refactored. &lt;span style="font-weight: bold;"&gt;Repeater pattern'run &amp;amp;for &amp;amp;action&lt;/span&gt; should be used instead&lt;/li&gt;&lt;/ul&gt;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.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-3152384437960002758?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/3152384437960002758/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/09/method-calling-in-elena-overhaul-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3152384437960002758'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/3152384437960002758'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/09/method-calling-in-elena-overhaul-part-2.html' title='Method calling in ELENA: overhaul, part 2'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-337368591328031322</id><published>2010-08-20T02:07:00.000-07:00</published><updated>2010-08-20T02:17:02.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='multi dispatching'/><title type='text'>Method calling in ELENA: overhaul</title><content type='html'>&lt;div style="text-align: justify;"&gt;As I already told several times ELENA is developed in "evolutional" mode (which is quite suitable for an open source project where there are no major releases and new versions are released often). It has its pros and cons but it is fun because you never know what will be next (except the pain from rewriting the whole code again and again).&lt;br /&gt;&lt;br /&gt;When I introduced a new syntax for sending messages in 1.5.5 I had no idea that already in 1.5.6 it will be overhauled  once again (though this time I will try hard to keep backward compatibility).&lt;br /&gt;&lt;br /&gt;Before I will outline what will be new in 1.5.6 I will shortly describe the history of the problem.&lt;br /&gt;&lt;br /&gt;I told this hundred times but it's worth repeating it again. ELENA is a highly dynamic language. This means that many approaches which are suitable and easy in the world of static languages may be problematic in the dynamic one.  One of them is sending messages. You may ask what problem may be with calling a method? Yes, in a statically typed language it is not a problem (though with typecasting you may shoot your feet easily) but in a dynamic one there is a chance that message meaning was overloaded (after all human languages are very ambiguous). You send "or" message  supposing the bit wise operation while a receptor treats it like Boolean one. So you either check the object type or pray that this time it will be ok. In ELENA it is even worse. A group object may consist of several objects many of them were not designed to work with each other so the chance of name conflict are quite high. After trying several other techniques I proposed the concept of a message namespace (though it was designed for other purpose).&lt;br /&gt;&lt;br /&gt;In 1.5.5 this concept gets final implementation (I hoped so but the time proved that I was wrong). Every message consists of a subject and a verb. The number of verbs are limited (like in many human languages) and well defined (in a theory, in reality it is more or less defined :)). The subject have to be defined in the program and usually belongs to the program use case. For example "or" is a verb. "Int" and "bool" are subjects (representing integer and Boolean values). So if you need bitwise "or" - "int'or" should be used, otherwise "bool'or".&lt;br /&gt;&lt;br /&gt;It appeared that the concept of subjects may be used not only for calling methods but for implementing multi-dispatching as well. std'basic'Integer and std'basic'LongInteger may support "int" subject, std'basic'Boolean, std'basic'True and std'basic'False support "bool" one. So if the receptor is dispatchable (it means the object support mutli-dispatching) the operation - receptor or:parameter - will produce different results depending on the parameter subject (in contrast to polymorphism where the result depends on the receptor type). If a parameter is an integer number - "int'or" will be executed. If a parameter is a boolean value - "bool'or". And so on.&lt;br /&gt;&lt;br /&gt;Moreover I found that the subject may help me with another problem. ELENA is a language with a limited operational set. It means that the object method may have only one parameter. Actually it is not a big problem. If you need to pass several parameters you may use something like this - control location'set: gui'common'Point { location'x'get = 0. location'x'get = 0} (where x and y are second level subjects). But the resulting code is quite clumsy. So with the help of the subject I was able to simplify it (though keeping original concept) - control set &amp;amp;location'x:0 &amp;amp;y:0.&lt;br /&gt;This approach made me happy until I started to migrate the code. It appeared that as a result I was forced to have two set of methods to support both of these expressions. And finally in 1.5.6 I found the way how to avoid it.&lt;br /&gt;&lt;br /&gt;So the new version of the code will look like this - control location'set &amp;amp;x:0 &amp;amp;y:0. Not a big difference you may say. In fact it is. This could will be translated by the compiler to the following one - control location'set:#hint[subj:location]{ location'x'get = 0. location'y'get = 0. }. Which is equivalent to the original one. So no need to duplicate. And "location'set" method may look like this - #method location'set &amp;amp;x:anX &amp;amp;y:anY [ ... ]. This method will be able to support both type of passing multiple parameters and multi-dispatching one as well - control set:point .&lt;br /&gt;Moreover I found that (once again :)) it may resolve another problem. Every time inline object was used the compiler create an appropriate VMT. As a result the code contains several duplicate VMTs. To resolve this some complex logic should be involved. Subject will fix this problem. Every time a subject with secondary items are declared the compiler will create a VMT. So no need to create them in place.&lt;br /&gt;&lt;br /&gt;No one can stop me from continuing :). If a subject is declared with VMT I may customize get method. So it may help to reuse some common patterns. E.g. in location'set I have to call int'get for x and y every time I used them (don't forget a parameter may be a group or proxy object). Instead of this I will be able to write something like this - #xsubject location ( x =&gt; x int'get, y =&gt; y int'get ) (#xsubject will be used instead of #subject for backward compatibility with 1.5.5).&lt;br /&gt;&lt;br /&gt;And finally (at least at the moment) I decided to simplify another thing. If you wish to return an object field you usually use the get method with secondary subject - point location'x'get. From 1.5.6 it will be possible to ommit get (and set) verb - point location'x (a subject cannot have a name coinciding with verb).&lt;br /&gt;&lt;br /&gt;If you ask me what will be in 1.5.7? I will honestly answer - no idea :)&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-337368591328031322?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/337368591328031322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/08/method-calling-in-elena-overhaul.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/337368591328031322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/337368591328031322'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/08/method-calling-in-elena-overhaul.html' title='Method calling in ELENA: overhaul'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-5732221801839499262</id><published>2010-08-02T16:38:00.000-07:00</published><updated>2010-08-02T17:07:49.421-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programng language'/><category scheme='http://www.blogger.com/atom/ns#' term='new programming language release'/><title type='text'>ELENA 1.5.5 released</title><content type='html'>I would like to inform about a new release of ELENA Programming Language.&lt;br /&gt;&lt;br /&gt;It took me almost 3 months to finish the work (I actually refactored ELENA library code twice). The changes are everywhere and unfortunately it means that the 1.5.5 is not compatible with 1.5.4 (now I do understand some software firms which do not like to support previous versions :)).&lt;br /&gt;&lt;br /&gt;Just short overview of the changes:&lt;br /&gt;&lt;br /&gt;1) hints:&lt;br /&gt;Instead of old style compiler hints - #class[...] Edit (Control) - the special keyword has to be used #hint[...] #class Edit (Control)&lt;br /&gt;&lt;br /&gt;2) messages:&lt;br /&gt;several messages (actually message verbs) like proceed, continue, ifnotnil are no longer supported, the new ones are evaluate, do, nil'ifnot&lt;br /&gt;&lt;br /&gt;3)Multiple dispatching mechanism is refactored and optimized. I will discuss this later in more details.&lt;br /&gt;&lt;br /&gt;4) A new type of group object is introduced - #union. I will discuss this later in more details.&lt;br /&gt;&lt;br /&gt;5) elena byte codes (ecodes) are redesigned, I continue to optimize the virtual machine command set&lt;br /&gt;&lt;br /&gt;6) context'get is no more supported, use instead enum'content'get (for enumerations) or indexer'content'get (for indexers)&lt;br /&gt;&lt;br /&gt;7) special type of messages is introduced to simplify passing the multiple parameters to the method (It took me so many years to invent the wheel but I'm quite happy with this implementation).&lt;br /&gt;&lt;br /&gt;So instead of - theEdit gui'size'set:gui'Size{ gui'size'Width'get = 200. gui'size'Height'get = 24. } more simplified version could be used - theEdit set &amp;amp;gui'size'width:200 &amp;amp;height:24. I will discuss this later in more details.&lt;br /&gt;&lt;br /&gt;Here the link - &lt;a href="https://sourceforge.net/projects/elenalang/files/ELENA/1.5.5/elena-1.5.5.zip/download"&gt;http://sourceforge.net/projects/elenalang/files/ELENA/1.5.5/elena-1.5.5.zip/download&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-5732221801839499262?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/5732221801839499262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/08/elena-155-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5732221801839499262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/5732221801839499262'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/08/elena-155-released.html' title='ELENA 1.5.5 released'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-6693511269347434272</id><published>2010-07-25T10:27:00.000-07:00</published><updated>2010-07-25T10:32:32.104-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='group object'/><title type='text'>Group Objects Example</title><content type='html'>Let's consider the use of group objects.&lt;br /&gt;&lt;br /&gt;In the next example I will demonstrate how to extend and customize code using branch-free self modifying code.&lt;br /&gt;(Note that 'project' should be replaced with a name of the source file)&lt;br /&gt;&lt;br /&gt;// --- namespace shortcuts ---&lt;br /&gt;#define basic'* = std'basic'*.&lt;br /&gt;#define ctrl'*  = std'patterns'*.&lt;br /&gt;#define list'*  = std'collections'*.&lt;br /&gt;&lt;br /&gt;#symbol Printing = anItem =&gt;&lt;br /&gt;[&lt;br /&gt;  // prints a parameter&lt;br /&gt;  'program'output &lt;&lt; eshownext =" anItem"&gt;&lt;br /&gt;[&lt;br /&gt;  // replace itself with ESkipNext&lt;br /&gt;  #inline elena'172 (self, $self, project'ESkipNext).&lt;br /&gt;].&lt;br /&gt;&lt;br /&gt;#symbol ESkipNext = anItem =&gt;&lt;br /&gt;[&lt;br /&gt;  // redirects the call to the next group item&lt;br /&gt;  $next proceed:anItem.&lt;br /&gt;&lt;br /&gt;  // replace itself with EShowNext&lt;br /&gt;  #inline elena'172 (self, $self, EShowNext).&lt;br /&gt;].&lt;br /&gt;&lt;br /&gt;#symbol Program =&gt;&lt;br /&gt;[&lt;br /&gt;  #var aList := list'List.&lt;br /&gt;  aList += 1 += 2 += 3 += 4 += 5 += 6.&lt;br /&gt;&lt;br /&gt;  // extending&lt;br /&gt;  'program'output &lt;&lt; "All items:%n".&lt;br /&gt;  #group(ctrl'EEnum, aList) run:Printing.&lt;br /&gt;&lt;br /&gt;  // customizing&lt;br /&gt;  'program'output &lt;&lt; "Every second item (1,3,...):%n".&lt;br /&gt;  #group(ctrl'EEnum, aList) run:#group(ESkipNext, Printing).&lt;br /&gt;&lt;br /&gt;  'program'output &lt;&lt; "Every second item (2,4,...):%n".&lt;br /&gt;  #group(ctrl'EEnum, aList) run:#group(EShowNext, Printing).  &lt;br /&gt;].&lt;br /&gt;&lt;br /&gt;The program start in Program symbol. Firstly we have to create a collection.&lt;br /&gt;&lt;br /&gt;  #var aList := list'List.&lt;br /&gt;  aList += 1 += 2 += 3 += 4.&lt;br /&gt;&lt;br /&gt;In the code below we will enumerate every member of the collection and print it.&lt;br /&gt;&lt;br /&gt;  // extending&lt;br /&gt;  'program'output &lt;&lt; "All items:%n".&lt;br /&gt;  #group(ctrl'EEnum, aList) run:Printing.&lt;br /&gt;&lt;br /&gt;aList is extended with ctrl'EEnum adapter. EEnum is a FOR EACH pattern, executing the action for every member of the collection it is combined with. Printing is a simple action which prints a provided parameter. In combination this code prints every member of the collection.&lt;br /&gt;&lt;br /&gt;Let's consider how could we customize it to print only every second item without if statement.&lt;br /&gt;&lt;br /&gt;  // customizing&lt;br /&gt;  'program'output &lt;&lt; "Every second item (1,3,...):%n".&lt;br /&gt;  #group(ctrl'EEnum, aList) run:#group(ESkipNext, Printing).&lt;br /&gt;&lt;br /&gt;Printing action is combined with a special adapter ESkipNext. ESkipNect redirects the flow to the next group item and modify the group by replacing itself with EShowNext. So during the next call EShowNext will be executed. EShowNext in its turn replaces itself with ESkipNext and so on. As a result we will print every second item of the collection. A voila.&lt;br /&gt;&lt;br /&gt;To be continued...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-6693511269347434272?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/6693511269347434272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/07/group-objects-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6693511269347434272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/6693511269347434272'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/07/group-objects-example.html' title='Group Objects Example'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-4606290087854367960</id><published>2010-07-22T13:34:00.000-07:00</published><updated>2010-07-22T13:44:25.431-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented'/><title type='text'>Group Objects</title><content type='html'>&lt;div style="text-align: justify;" class="entryContentContainer"&gt;Let us define a &lt;u&gt;&lt;wbr&gt;group object&lt;/u&gt; as a collection of the  objects accessible through the common instance reference. The member  objects may or may not have any relations with each other. They may or  may not have intersecting message mapping. The content of the group can  be changed dynamically during the object life time (sel&lt;wbr&gt;f-mo&lt;wbr&gt;difi&lt;wbr&gt;cati&lt;wbr&gt;on).&lt;wbr&gt;  The member objects can be a part of different groups or be single. They  may not even notice they become a part of the group (dynamic  overriding). The group can be persistent or temporally created to solve  the particular task. In general the group objects are treated like "&lt;wbr&gt;normal"&lt;wbr&gt;  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.&lt;br /&gt;&lt;wbr&gt;So how may group objects be used? Let us consider several possible use cases: code customization, "&lt;wbr&gt;branching-free"&lt;wbr&gt; / self-modifying algorithms and horizontal inheritance.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Customizing / Extending existing code&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;The  concept of the group object may be used for modifying the existing  code. Sometimes only minor changes should be applied to the code to be  reused. Commonly we may override the class. Or we could combine it with  the special adapter class containing only the methods we would like to  change (actually dynamically override it, see horizontal inheritance). Though  this two patterns are quite equivalent, the group can be formed with  any object implementing a particular protocol at a run time. And in  contrast to an aggregation we have to implement only the methods we  would like to change without affecting others (which is quite important  for the dynamic language where we do not always know the object type).  Moreover in some cases we will not need to write a new code at all, only  combining well-defined components.&lt;wbr&gt; In general it  allows us to inject the code into the complex system without big  modifications and this injection may be invisible for other parts of it.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;"&lt;wbr&gt;Branching-free"&lt;wbr&gt; algorithms&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;The  content of the object group may be changed during its life time and it  gives us quite an interesting feature: every time the group internal  state is changed its actual content may be changed as well. Though the  total number of the different states is quite big we can always select  several extreme ones (empty list, unassigned reference, read-only  collection and so on), place the code related to them into a separate  control object (or several ones) and combine it with the main code. So  when the group state is changed the control object replaces itself with  the appropriate one instead of checking the state every time  (alternatively the control object may have a several set of VMTs). Self  modifying group can be used as well in many cycle algorithms where the  first or the last action are different from the main ones.&lt;wbr&gt; The real "&lt;wbr&gt;branch free"&lt;wbr&gt; code is unlikely to be feasible but the moderate usage can still simplify the code.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Horizontal inheritance&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;Group  object can be used as an alternative to a multiple inheritance as well.  Common satellite classes can be included in different groups allowing  them to share the code without actually inheriting it, helping us to  reduce the depth of inheritance tree.&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;Having looked at several use cases let us examine the possible implementation of the group object concept&lt;span style="font-weight: bold;"&gt;.&lt;br /&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;Possible implementation&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;Being  born as a part of the dynamic language study the group object  definitely requires a pure polymorphic language with a late binding. For  implementation simplicity the concept of limited object interface was  introduced. We presume that any class method may have only one input and  one output parameters. If the method does not require any parameter a  special void parameter is passed (e.g. nil constant). If the method does  not require to return anything it returns itself (e.g. self variable).  As a result we have a system with relatively big number of "&lt;wbr&gt;simple"&lt;wbr&gt;  classes actively interacting with each other to resolve any task (so we  can say that the number of inter-class calls tends to be higher than  the number of  inner-class ones). Finally let us introduce a proxy  handler concept. The proxy handler is a special kind of a method which  is executed every time there is no message mapping in the class VMT. It  may redirect the call to the specific target.&lt;br /&gt;Summering  all above any group object consists of the array of group members and a  VMT containing only a special proxy handler. Depending on the type of  the group it redirects the call to the first object handling the  appropriate message (exclusive mode) or to all members (broadcast mode).&lt;wbr&gt; Every  time a member method is called the reference to the group is passed to  it rather than to the object itself. So when the method calls another  object method it is in fact redirected to the group (dynamic  overriding).&lt;br /&gt;The only problem with this approach  (except performance of course) is an access to the object fields. To  solve it we need to keep the reference to the object as well. In a  standalone mode both variables refer to the object. In fact having two  object references allows &lt;wbr&gt;the programmer to decide whether the method call might be overridden or not.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Name conflicts&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;But  how predictable could such groups be? After all we combine the objects  which are not always well known to us. Will there be any message  conflict leading to unexpected results? To ease this problem we may  introduce the concept of the message namespace. &lt;wbr&gt;The words in a human language are quite ambiguous and as a result the message names may be ambiguous too. "&lt;wbr&gt;AND"&lt;wbr&gt; could be bitwise or Boolean operation, "&lt;wbr&gt;GET"&lt;wbr&gt;  may return any value and so on. So let us introduce a special language  entity of a message scope which describes well-defined term (e.g. "&lt;wbr&gt;integer"&lt;wbr&gt;, "&lt;wbr&gt;boolean"&lt;wbr&gt;) and list possible operations with it &lt;wbr&gt;(e.g. "&lt;wbr&gt;get"&lt;wbr&gt;, "&lt;wbr&gt;and"&lt;wbr&gt;  ,...). Any message used by the group member should belong to one or  another message scope (which has to exist physically). As a result the  chance that the different members of the group will use occasionally  similar messages is quite small.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Critical review&lt;/b&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;Though  the scheme above seem a bit complex it costs not so much: an extra  check per message call and an additional object variable (if we compare  it with the cost of transition from a static call to a dynamic one). But  in any case we are facing a bigger concern - redundancy. It is easy to  show that most of the possible features could be implemented without  groups (after all any high level programming language is translated to  the machine codes and by definition cannot be more powerful than the  assembler).&lt;br /&gt;&lt;wbr&gt;&lt;br /&gt;&lt;wbr&gt;So is the introduction of the new entity  really justified? And though there is no simple answer to this question  several reasons can be mentioned. First of all it promotes more  polymorphic and extendable code. The possibility to customize the object  behavior without actually knowing much about it (except supporting  protocols) will give a programmer more flexible way to deal with  existing / reusable code. Secondly this approach reshapes the system  structure. Instead of multifunctional classes we will get plenty of  rather simple ones with limited functionality which can be easily tested  and reused. And finally combining them into super entities makes the  system more open and configurable.&lt;br /&gt;To summarize this  type of redundancy  may be a key factor how to build and maintain more  powerful and complex systems with an open architecture. And though it is  too early to say if the concept of the group object makes the  difference it can give a boost to active use of more structural  self-modifying collaborative code.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-4606290087854367960?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/4606290087854367960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/07/let-us-define-group-object-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4606290087854367960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/4606290087854367960'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/07/let-us-define-group-object-as.html' title='Group Objects'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-406313945329813109</id><published>2010-07-21T13:47:00.000-07:00</published><updated>2010-07-21T13:53:54.992-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='programming'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>General language overview</title><content type='html'>&lt;div style="text-align: justify;"&gt;In the next several posts I will try to describe the language general overview, proposed programming paradigm and basic code patterns. So let's begin.&lt;br /&gt;&lt;br /&gt;ELENA is an object-oriented programming language with the late binding. It means that it belongs to the same class as Smalltalk rather than C# or Java. It is a non-mainstream language and is used as a testbed for experiments with the language design, dynamic and self-modifying code and so on. So don't expect it will be easy to learn. Probably someone may say it is weird but I like its dynamic nature. It has weak sides but it DOES work. And finally it is a live language in the process of developing.&lt;br /&gt;&lt;br /&gt;Let's consider several major language features which I will discuss in more details later.&lt;br /&gt;&lt;br /&gt;ELENA is a language with the reduced class interfaces. It assumes that there is only limited way to interact with the object on the base of protocols supported by it. Any class method should perform an atomic operation, be quite small and support only one parameter. Moreover the strong concept of reduced class interfaces limits the possible operations between classes (belonging to different modules) to the small list of well-defined messages - verbs (though it is possible to provide "subject" for each verb, i.e. with "get" verb we can use several distinct messages: int'get or game'player'get). The method cannot have more than one parameter. As a result the method parameter tends to become an active partner. The method has to ask the parameter to return the required information, so the method caller has some control of the method work (in combination with dynamic mutation we could have some kind of two-way interaction).&lt;br /&gt;&lt;br /&gt;ELENA is a language with a reduced operational set. Practically the only supported operation is sending a message to the object with a parameter. Conditional (#if) statement extends this operation with possibility to use multi-statement blocks and loop (#loop) one just repeats it until it fails. The only way to control the flow is message chaining. An ELENA program code is a sequence of actions (sending a message) enclosed in square brackets (Unlike Smalltalk the sub code is a sequence of action as well). The execution of every next action happens only if the previous one was successful. Otherwise the control goes to the closest alternative action and the flow continues. Alternative message chains are used in ELENA not only for handling exceptional situation but (and mostly for) conditional branching. The program code could explicitly break the execution (by sending fail message) to indicate the negative result of the method.&lt;br /&gt;&lt;br /&gt;ELENA is a dynamic language supporting different run-time code manipulations. One of them is a static mutation. It is presumed that an object may have several alternative sets of VMTs (roles) and switch between them depending on its state. Though the total number of these states can be big enough we could always select several extreme ones (such as an empty string, unassigned container). Such cases could be implemented as class roles containing the code which is applicable only in the particular state. Only in the place where it could be changed (copying the value, assigning the object) we will check the situation and switch between roles. In most cases the bulk of the code would not be affected so there could be only several quite simple roles. But in some situation the whole code is divided between roles. E.g. Boolean variable could have two (or three) roles: true, false values (and undefined one).&lt;br /&gt;&lt;br /&gt;ELENA supports a dynamic mutation as well. It means that we can dynamically override any public object method. This mutation could be either stable or temporal (if it is included into the temporal object group) and be accessible both inside and outside the mutated object (though inside the object we can explicitly decide if we allow overriding). It is possible either extends the object with some custom code or combine it with the number of other objects (so called object satellites) into a group object (will be described in the next post).&lt;br /&gt;&lt;br /&gt;Concept of the group objects is one of the most interesting ELENA feature and I will continue to investigate it hoping that it will help to create self-modifying systems with truly open architecture (that in my opinion may lead to creating a very complex highly adaptive autonomous programs).&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-406313945329813109?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/406313945329813109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/07/in-next-several-posts-i-will-try-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/406313945329813109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/406313945329813109'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/07/in-next-several-posts-i-will-try-to.html' title='General language overview'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6612268259362701123.post-1665665663606923049</id><published>2010-07-21T13:41:00.000-07:00</published><updated>2010-07-21T13:47:28.223-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='elena programming language'/><category scheme='http://www.blogger.com/atom/ns#' term='object oriented programming'/><title type='text'>Yet another programming language</title><content type='html'>&lt;div style="text-align: justify;"&gt;Probably every person hearing about a new language asks this question: why yet another programming language? I cannot say about all but me. When I decided 10 years ago to create a new programming language I had several reasons. First of all it was a perfect way to learn C++ (as many Russians I came from Pascal &amp;amp; Delphi world). But most of all I was interested in object-oriented programming. For me it was a perfect chance to learn more about it. I was fascinated with Smalltalk and decided to do something similar.  Writing the compiler is a quite challenging task but it cannot be compared with the task of creating a language or a programming paradigm (after all the most valuable things in our world are ideas). So after several attempts to invent / create something original I decided to follow other way: implement something simple and gradually modify it in hope to find something interesting. So step by step the language grew (practically any part of the compiler / language was rewritten / refactored at least several times) and now it has nothing common with the one I decided at the beginning. And though many of its ideas which I thought were original are used in other languages ELENA has its own individuality and style.&lt;br /&gt;&lt;br /&gt;So how could I answer on this question? Is ELENA yet another programming language. The answer is not simple. Yes, ELENA may be considered as another amateur language with small source code base and lack of bug tracking functionality. And no, ELENA is a conceptual language. It is designed to examine / prove feasibility of several basic concepts. From the beginning I tried to make the language as dynamic  as possible. My ultimate goal is to create the programming systems with truly open architecture, the systems which can be modified / extended in run time, the system where a big number of "simple" objects actively cooperate with each other forming group objects, able to self-modify. Will the language become something more than experimental one? Only time will show. Honestly I have no idea where the language will be in the next several years. One thing I may say definitely - it will be different.&lt;br /&gt;&lt;br /&gt;In this blog I will try to show my current ideas and the state where the language is. &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6612268259362701123-1665665663606923049?l=elenalang.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://elenalang.blogspot.com/feeds/1665665663606923049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://elenalang.blogspot.com/2010/07/yet-another-programming-language.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1665665663606923049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6612268259362701123/posts/default/1665665663606923049'/><link rel='alternate' type='text/html' href='http://elenalang.blogspot.com/2010/07/yet-another-programming-language.html' title='Yet another programming language'/><author><name>Alex Rakov</name><uri>http://www.blogger.com/profile/07048022221464521244</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
