o42a-0.2.2 Release Notes

Syntax Changes

This release contains a significant syntax changes, which are not backward compatible.

New Comments Syntax

C-style comments used since the beginning of o42a development are gone now. They look too foreign to the language syntax.

The new, original comment syntax tries to make a comments more recognizable and also prevents some poor practices of commenting out the code.

Both inline and block comments are supported:

~~ Inline comment to the end of line

~~ Inline comment to the closing tildes ~~

~~~
Block
comment
~~~

Apart from using tildes as comment bounds, there are some significant differences with a C-style comments:

  • An inline comment can be closed (with two ore more tildes). Otherwise, it will occupy the rest of the line. Thus an inline comments can not occupy more than one line.
  • A block comment requires it’s boundaries (consisting of three or more tildes) to be placed on a separate line. Nothing except spaces can be placed on the same line.

Text Blocks

Text blocks can be used now to define a multi-line strings:

"""""
Multi
line
text
"""""

Text blocks do not recognize an escape sequences.

Also, string literals and text blocks are always recognized as expression continuations now. There is no need to place an underscore to specify this.

Extended Macro Support

Macro expansion can be used in more places now. They are recognized as statements, operands, and field definitions.

Macro Field Expansion Syntax

A special syntax were added to expand macro fields:

Foo #macro [arg]  ~~ Where `macro` is a macro field of object `foo`.

The above is the same as:

#Foo: macro [arg] ~~ When `foo` is an ordinary object.
#Foo` macro [arg] ~~ When `foo` is link.

Standard Macros

A cast macro field was added to link, variable, and getter. It can be used to cast a link to the required type upon it’s value override. This macro prevents an incompatibility error from raising inside the prototypes and makes it possible, e.g. to access a link target’s adapter even if there is no such adapter in the base object.

Also, a standard Macros library were implemented and a special syntax implemented to expand macros defined inside of it:

Lnk := `123
##Interface [lnk] ~~ Integer

The above is the same as following:

Use object 'Interface' from 'Macros'
Lnk := `123
#Interface [lnk] ~~ Integer