Sunday, February 5, 2012

Full Object-Oriented Programming support in rev 2.0 alpha 0.5

We have just made available a new alpha release of the prototype ParaSail compiler and virtual machine, rev 2.0, alpha 0.5:

This new release has full support for inheritance and polymorphism.  In ParaSail terms, this means that you can now use polymorphic types, using the T+ syntax, and you can define one module as an extension of another, using the extends keyword.  (The implements keyword was already supported in earlier releases.)  This release includes a new example, "expr_tree.psl", which illustrates a hierarchy of types defined using module extension and polymorphic components.  As usual, we include executables for Mac, Linux, and Windows.

The prior blog entry discussed the implementation of polymorphic objects.  An upcoming blog entry will discuss the implementation of the inheritance of operations and components.  As in Java, C#, and Ada, ParaSail supports single inheritance of implementation, and multiple inheritance of interfaces.  The multiple inheritance of interfaces was implemented from the very first ParaSail release, but this is the first ParaSail release that supports inheritance of the implementation of operations, and of components.  This involved some additions to the virtual machine instruction set, and significant work in the compiler.

Both polymorphism and inheritance (of implementation) are handled by ParaSail in a somewhat non-traditional way, in part because there are no pointers in ParaSail, and in part because objects are expandable "in place" without the use of pointers.  Polymorphic objects in ParaSail can be assigned new values which are of different types in the hierarchy.  In most object-oriented languages, only pointers or references can be truly polymorphic; the type of a particular object is set when the object is created and cannot change during its lifetime.  See the prior and upcoming blog entries for more details, as well as the reference manual included with the above release in the "doc" subdirectory and the "expr_tree.psl" example in the "examples" subdirectory.

No comments:

Post a Comment