o42a-0.2.5 Release Notes

Type Parameters

Type parameters can be declared for any object now.

They can be declared inside a type definition and used as macros, i.e. they can be expanded:

Map :=> void #( 
  ~~~
  A key/value map interface.
  ~~~
  Key type := void   ~~ Key type parameter.
  Value type := void ~~ Value type parameter.
) (
  Get :=> link (`#value type) (
    ~~~
    Returns a value by its key.
    ~~~
    Key :=< link (`#key type)  ~~ A key of the value to find.
  )
)

Type parameters can be passed to constructed object with type parameters syntax:

Map (`string, integer)

Unlike ordinal fields, type parameters are accessible even when declared for prototype. They can refer each other, but can not refer the object they declared for, or its fields.

Syntax Improvements

Numbers

Hexadecimal, binary, and floating point number literals are supported now.

The + or - sign preceding the number is considered its part: it’s not an operator any more.

Compare Operator

New compare (<=>) binary operator has been added. It is a more generic form of object comparison. It is overridable and can resolve to any expression, but in order the other comparison operators to work it have to resolve to an integer expression.

Suffix Operator

A new overridable suffix (~) operator has been added. It is called so because it reverses the order its operands interpreted: the right operand is used as a constructed phrase prefix, and the left one - as its first argument. This makes it suitable for implementing things like quantities:

3~minutes

Grouping Expression

A special grouping expression can be used instead of the parentheses at the very beginning of any expression. So, the following expression:

("Some string": substring _from [5]) [1]

can be written without any parentheses:

"Some string": substring _from [5]\ [1]

Simple Clause Identifiers

Clause identifiers have syntax similar to corresponding phrase parts, without any syntax overhead:

Int :=> integer (
  <[]>  ~~ The declaration.
)

Int [5] ~~ The usage.

Fixes, Fixes, Fixes…

The o42a code base was never carefully tested. So, any new non-trivial piece of code written in o42a reveals a bunch of new bugs.

The work on collections module have been started during this release cycle. This caused a lot of debugging and bug fixing. Hope the code is much more stable now.

Runtime License Change

The language runtime license have been changed to the MPL-2.0. The LGPL is not suitable, because it only works for dynamic linking, which is impossible with o42a.

LLVM Upgrade

o42a requires LLVM version 3.2 now.