New Release of Essence Sharp: Nīsān-2 (Alpha Build 23)

The Nīsān-2 release contains only bug fixes and internal improvements.

Download Nīsān-2 (Alpha Build 23)

To download the latest release, navigate to the DOWNLOADS page on CodePlex. There’s a download link in the upper left corner of the DOWNLOADS page, labeled Essence#_Nisan-2_Setup.exe. Using it will get you a program that will install the Nīsān-2 release of Essence# to any location you choose on your computer. Please see the documentation page on the CodePlex site for more information on how to use Essence#, such as the installation instructions and instructions on how to run scripts written in Essence#.

The Nīsān-2 release makes no changes or additions to the Essence# Standard Library. The Essence# Standard Library will be installed by the installer program attached to this release. It may also be obtained separately fromGitHub.

None of the utility scripts that aid in developing Essence# code were changed in this release. For more information on the scripts, please see the documentation.

Essence# Syntax: Self Expressions

A self expression is essentially a (possibly cascaded) message sent to self, except that the pseudo-variable “self” is omitted. The value of the “invisible self” that receives the message is established by configuring the compiler to set the pseudo-variable self to the desired value during execution of the self expression.

A self expression is allowed just one message chain having just one message receiver–and the receiver must not be specified syntactically.

Conceptually, the syntactically unspecified–and therefore implied–receiver of the message(s) in the message chain of a self expression is the pseudo-variable self. That’s because the same compiler infrastructure used to set the pseudo-variable self to the correct value during the execution of a method or block is also used to set the value of the implied, unspecified receiver of the message(s) in the message chain of a self expression, and also because a self expression is parsed by the parser simply by adding an actual parse node for the pseudo-variable self as the receiver of the message(s) in the message chain of the self expression. That’s possible because the parser implements self expressions as their own “root parse node” or “grammatical start symbol.”

Any syntactically-valid expression which sends a message to an operand can be converted into a self expression simply be removing whatever syntactical construct is the receiver of the message (a.k.a, the leftmost operand in an expression.) The following examples show two pairs of expressions, where the first member of the pair uses self expression syntax and the second one does not:

Configuring a class

"Using 'self expression' syntax:"

        superclass: Object; 
        instanceVariableNames: #(red green blue)

 

"Using 'expression' syntax:"

        Color 
                superclass: Object; 
                instanceVariableNames: #(red green blue)

 

Adding methods to a class (using method literals to define the method):

"Using 'self expression' syntax:"

        protocol: #accessing 
        method:
                [## red
                        ^red
                ]

 

"Using 'expression' syntax:"

        aClass
                protocol: #accessing 
                method:
                        [## red
                                ^red
                        ]

 

Prior Art

The inspiration for self expressions comes from Tirade, a data representation language invented by Göran Krampe. The main reason that Essence# uses self expressions instead of Tirade is simply because, once you have a full parser/compiler, it is significantly simpler to implement self expressions than to implement Tirade. Given a full compiler, implementing self expressions only involves adding a few, relatively small methods to the parser and compiler. And it also technically doesn’t require adding new syntax to the language, since self expressions only use syntactical forms that would have to exist in any case; the only innovation is to permit simpler syntax that omits an otherwise-required syntactical construct. So self expressions were “the simplest thing that could possibly work.”

That said, Tirade would be a much superior solution to the problem of programming-language neutral data interchange. But that’s not the problem that self expressions are intended to solve.