New Release of Essence#: Lot-3 (Alpha Build 9)

Lot-3 is very probably the most robust and stable release so far published. It also has the most functionality. Since it is now 3 and a half weeks since the initial public release on 26 May, now would be  a good time to step back and review our progress:

Since the initial release (“Eden,”) we’ve greatly enhanced the site’s documentation, greatly enhanced the functionality of the ES tool that runs ES scripts, created an installation program using Nullsoft’s NSIS installation program generator, enhanced the Visual Studio solution and project configuration/build files so that it’s relatively easy to compile the Essence# run time system for any combination of .Net framework and processor architecture (Essence# can be compiled for any .Net framework version from 3.5 onwards, and can be compiled either as a 32-bit or as a 64-bit application,) added the capability to define Exception classes and to raise and handle Exceptions (including native CLR exceptions,) added the classes Set and OrderedCollection to the Essence# Standard Library (even the initial release already had arrays, Dictionary and IdentityDictionary,) significantly enhanced the functionality of Characters, Strings and Symbols, added many fundamental methods to the abstract classes in the Collection hierarchy, added many classes and methods needed to make instances of the CLR Collection classes look and act like native Essence# collections, made key improvements/enhancements to inter-language interoperability, fixed many bugs, and substantially improved the usability and robustness of the system.

This release extends the ability to pass blocks as arguments to CLR methods: Previously, that would only work if the static type of the corresponding parameter was a delegate whose return type and parameter signature exactly matched that of the block passed in as an argument–meaning the delegate’s return type had to be Object, all of its parameters had to have Object as their static typing constraint, and the name of the delegate had to match (e.g, “System.Func<>”.) In other words, the odds that it would work weren’t all that good.

But as of the Lot-3 release, the only thing that matters is whether or not the delegate and the block have the same number of parameters, and whether or not there is some way to type convert between the actual type of each argument at run time and the static type of the delegate’s parameter (and the same applies to the delegate’s return type and the value actually returned by the block.) And the delegate name is now irrelevant, meaning that a block with a single parameter can be passed in as an argument when the corresponding parameter type is Predicate<T>. So the following code will now work:

| list |

list := OrderedCollection new.

list addAll: #(3 5 8 13).

list find: [:x | x \\ 2 = 0] “The message #find: will bind to the CLR method List<T>.Find(Predicate<T>); it has essentially the same semantics as #detect:”

The class OrderedCollection is an Essence# class that represents and defines the behavior in Essence# code (and only in Essence# code) of instances of the CLR type System.Collections.Generic.List<Object>. In spite of that, OrderedCollection instances will respond to all the standard messages in the standard manner, as though they were fully native Essence# objects. And by the way, the class OrderedCollection resides in the default Essence# namespace, instead of residing in the CLR.System.Collections.Generic namespace. To see how that’s done, browse the code of OrderedCollection in the Essence# Standard Library.

The new release can be downloaded from the Essence# site on CodePlex (which gets you the installer.) Alternatively, the code for the run time system (written in C#) can be obtained from the Essence# CodePlex site using Git, and the code for the Essence# Standard Library can be obtained from GitHub.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s