o42a-0.2.7 Release Notes

Type Arguments

The new syntax for passing of type arguments have been implemented. Now, arguments should be written before the type:

Here are some examples:

integer` link               ~~ Link to integer.
string` array               ~~ Array of strings.
string` array` link         ~~ Link to array of strings.
(string` array)` link       ~~ The same as above.
(string, integer` row)` map ~~ Map of string keys to integer row values.

Initializers

Initializer phrase parts supported now.

An initializer phrase part looks similarly to the phrase argument, i.e. it is a value specified in square brackets. The difference is a = sign prefixing the value itself:

Phrase [= value]

Initializers intended to be used to provide the initial values for objects, in contrast to more general purpose arguments.

An initializer has a special syntax suitable for field initialization:

Field := type = value

, which is a more convenient form of the following declaration:

Field := type [= value]

The links and variables syntax and behavior changed significantly in this release.

The special syntax for link and variable field declarations have been removed.

Links and variables can be constructed with appropriate unary operators now:

My link := `target
My variable := ``initial value

or by utilizing the type arguments and initializers syntax:

My link := string` link = "abc"
My variable := string` variable = "initial value"

Links and variables are no longer dereferenced by default. Instead, an automatic link dereferencing is performed when needed, allowing transparent access to the link target in several situations:

  • When a link member is referenced, the member is first searched for in the link object itself, and if not found, then it is searched for in the link target.
  • When converting a link to another type, an attempt to convert the link object itself is performed (e.g. by searching for appropriate adapter), and if failed - the link target is converted.
  • When interpreting the phrase with prefix resolving to a link, the clause corresponding to the first phrase part is first searched for in the link object itself, and if not found - in the link target.

In other cases the link should be dereferenced explicitly, with -> construct.

The link body reference syntax is removed. It is no longer needed, as links and variable can be referred to as any other objects.

Macro Expansion

The macro expansion expression is no longer an unary operator. Now, the scope reference # can be used to expand the referred macro. This is done to unify the # symbol usage, as in all other cases it is treated as reference.

This change also allows to use a macro expansion as type argument without enclosing it into parentheses:

#t` link ~~ Link to object of type `t`