Blog

Source:

From (archived) CodePlex:

Essence# is a fully dynamic and highly polymorphic programming language which features pervasive message passing, pervasive dynamic and strong typing, pervasive and deep reflection and pervasive object orientation. Essence# implements and reveals the "essence" of object-oriented programming:

Message passing: Almost all computation in Essence# happens via the sending of messages. The only way to invoke a method is to send a message—which necessarily involves dynamic binding (by name) of message to method at runtime (and never at compile time.) The internals of an object are not externally accessible, ever—the only way to access or modify an object's internal state is to send it a message. So function and data encapsulation and abstraction are both complete and universal.

Dynamic and strong typing: Although any object can be assigned to any variable, the only way to access or modify the internal state of an object is to send it a message—and the sending of any invalid message is detected and prevented at run time. So, even though Essence#'s pervasive use of dynamic typing enables the programmer to define highly polymorphic abstractions with an extremely high degree of applicability and reusability, it is impossible to apply a function to a value for which there is no valid, defined behavior.

Reflection: In most programming languages, the specifications of types, classes, functions and subroutines exist only in the source code, and so are not accessible at runtime. But in Essence#, all specifications of all program constructs (classes, methods, etc.) are live objects that exist both at compile time and at runtime—and those objects are fully accessible to a running program, and can be queried or modified by sending them messages. So an Essence# program can not only fully introspect on itself, it has full power to change itself.

Object-orientation: In Essence#, all values are objects—even booleans, integers and other numbers, characters, strings, classes, blocks of code...and even"null." That's right, in Essence# you can not only send messages to "null," you can even add methods to the class of "null," and then send "null" the corresponding messages! That's because all Essence# values are instances of a class, and so can all be sent messages. And Essence# classes can be created and modified while the program is running. In Essence#, almost all computation is done by sending messages.

Inter-language interoperability: Thanks to the DLR's Meta Object Protocol, Essence# provides deep and comprehensive integration and interoperability with other programming languages that are hosted on the CLR, whether those are statically-typed languages such as C# or are dynamically-typed languages that use the DLR's Meta Object Protocol.

In fact, Essence# serves as an excellent language for scripting the creation and manipulation of C# objects (for example.) The original motivation for the creation of Essence# was to use it as a domain specific language for creating and configuring C# objects that specify trading plans generated in response to trading signals. It has been and is being used for that purpose by the original implementer.

Necessity is the essence of invention. :-)

InfoQ article:

In Essence#, most of the classes will derive from one of the following object state architectures.

There is a variety of system architectures as well. These architectures are used for the language’s infrastructure rather than for custom types. Some of the more interesting architectures include:

Traits

Traits are Essence#’s answer to multiple inheritance. Traits are sets of functionality that can be imported by a class, but they are more than just cut-and-paste methods handled by the compiler. So first, let us talk about how they differ from normal methods.

With one exception, methods imported from a trait should be indistinguishable from those implemented locally by the importing class or trait. The exception is that methods defined in a trait bind to non-local variables (e.g, class variables) based on the namespace environment of the trait that defines the methods, and not based on the namespace environment of the class or trait that uses (“imports”) those methods.

Currently Essence# does not allow instance variables to be defined or referenced by traits. That may change in the future.

Traits don’t have to be used entirely as-is; they can be combined to create new traits. Combining traits isn’t like combining interfaces where you have to include every method from each source. Instead, you have to work with three operators.

The '+' operator allows you to combine the unique methods of two traits. As a way of dealing with name collisions, if a method is defined in both traits being combined with the '+' operator, the method is excluded.

Since that is probably not what you want to happen, you can use the '-' operator to remove the unwanted method from one trait so that the method will be expressed by the other trait. Or you can use the '@' operator to rename the method on one of the base traits.


Tags: clr   language  

Last modified 07 October 2024