o42a-0.2.10 Release Notes

This release contains a lot of significant changes to the language. A lot of features were simplified, replaced, or just removed. This was necessary primarily to reduce the complexity of the compiler. Several new important features were added also.

No More Multiple Inheritance

The multiple inheritance support caused a lot of problems to the implementation. So, I decided to remove it. The adapters could be a replacement for multiple inheritance in many situations. It is a composition-over-inheritance choice. Given the fact that composition in form of adapters is supported at language level, it makes o42a somewhat better in this aspect than other OO languages.

Simple Value Definition

The object value definition algorithm was too complicated. Now, the value definition is no longer consists of claim and proposition - it is a single function now.

Object Statefulness Replaced

… with eager value evaluation.

The keep value operator was removed, along with object statefulness.

Instead, an eager reference was added. It has simpler implementation and more predictable behaviour.

The syntax is Expression>>. This reference evaluates the value of expression, constructs a new object inherited from expression and returns it. The value of the resulting object is constant, and equal to previously evaluated value of expression.

This makes it possible to preserve the evaluated object value instead of evaluating it on each request.

Short Adapter Declaration Syntax

Adapters can be declared and/or overridden with shorter syntax.

The following:

@Main (
  Print "Hello, World!" nl

is a shorter way to write:

@Main := * (
  Print "Hello, World!" nl  

The short syntax construct either overrides an inherited adapter, or declares a new one.

Short Field Override Syntax

A field can be overridden with shorter syntax too.

The following:

*Field (
  ~~ Definition

is a shorter way to write:

Field = * (
  ~~ Definition

Unlike a short adapter declaration syntax, the short field override syntax only allows to override fields, but not to declare new ones.

Static Fields

A static field can be declared now like this:

Field ::= void (
  ~~ Definition

Static fields are named objects declared only once. They never propagated to inherited objects, and can not be overridden. But they still accessible from inherited objects, just like any other field.

A static field can only be declared in a module or inside another static field.


Aliases are named expressions which can be accessed just like fields.

An alias can be declared like this:

Alias :- expression

Aliases can not be overridden. But when the alias expression is a reference to the field of the same owner object, the alias becomes just another name for that field, and can be used interchangeably with it.

Yield Statement

A new yield statements was added:

<< value

Just like a return statement this one returns a value. But next time the value of the same object requested, the value evaluation continues from the next statement.

This allows to easily create value generators:

Generator := integer (
  << 1
  << 2
  << 3

Print [generator, generator, generator] ~~ Prints "123"

Syntax Changes

The ellipsis statement (...) was removed in favor of continuation sentences. I.e. sentences terminating with ellipsis (...).

Also, a combined sentence terminators were added: continued exclamation (!..), which allows to exit a named block, and continued interrogation (?..), which is a short syntax for empty continuation sentence immediately following an interrogative one, i.e. the same as ? ....

The local declarations now always require a $ prefix to avoid possible conflicts with field declarations. The := and = signs can be used interchangeably for local declarations. So, a valid local declarations could look like this:

$Local 1 = value 1
$Local 2 := value 2

The value assignment syntax was changed completely to avoid any possible similarities with field or local declarations. Now, a << symbol is used for value assignments, including combined assignments:

Variable << value ~~ Assign `value` to `variable`
I +<< 1           ~~ Increase `i`.

Also, the value assignment is implemented using eager value evaluation. So that it became just a syntax sugar for binding statement like this:

Variable <- value>>

Features Removed

The phrase outcome feature was removed. It wasn’t very useful. And without it a meaning of a phrase is easier to estimate.

The multi-section source files are no longer supported. Along with it, an explicit inclusion statement became unnecessary and was removed.