o42a-0.2.6 Release Notes

Locals

Locals are named expressions existing during the value evaluation only.

A local can be declared similarly to a field:

$Local := expression

Such local will be visible in the same code block after its declaration.

Local Scope

There is also a special syntax, which allows to declare the local along with its visibility scope. It is called local scope. In this case a local name is declared after its value and separated from it by $ sign. The following statement (separated from local declaration by colon) is the only one that can access the local declared this way:

Expression $ local: $local + 1

1 $ left:
2 $ right (
  = $Left + $right
)

A local name can be omitted. Such local is called anonymous and can be accessed with $ or $$ references.

A variant of local scope declaration can be used for variable assignment, and is allowed both inside the imperative and declarative code:

Variable $= value

This syntax can be used to implement things like increment in C-like languages, or even more interesting ones:

Names [n] $= "Sir " + $ ~~ Prefix the Nth element of `Names` array
                        ~~ with "Sir " prefix.

Intervals

An interval is a special syntactical construct suitable to represent all kinds of intervals: opened and closed, bounded and unbounded:

[a...b] ~~ Closed interval
(a...b) ~~ Open interval
[a...b) ~~ Right-open interval
(a...)  ~~ Left bounded open interval
(a...-) ~~ The same as above
(...b]  ~~ Right-bounded interval.
(∞...b] ~~ The same as above.
(...)   ~~ Fully unbounded interval.
(∞...∞) ~~ The same as above.

Intervals are only allowed inside phrases. They are used, for example, to extract substrings:

"abcde" [1...4) ~~ "bcd"
"abcde" [1...)  ~~ "bcde"
"abcde" (...4]  ~~ "abcd"
"abcde" (...)   ~~ "abcde"

Syntax Changes

The line is considered a continuation of preceding one only if it starts with an underscore. Only spaces can precede the underscore on the same line. No comments allowed.

Some of the scope references syntax changed. New scope references are:

  • // - root object reference,
  • / - module reference,
  • $ - local reference,
  • $$ - anonymous local reference.

Unary operators:

  • \ - value of,
  • \\ - keep value.

Both unary and binary operators accept Unicode symbols now. For example, a not equal operator can be written as , division one - as ÷, less than or equal - as , not operator - as ¬, and so on.

Intrinsic reference ($object$ and $prefix$) are no longer supported. Corresponding local references can be used instead inside clause content ($object and $prefix respectively).