o42a-0.2.8 Release Notes

Stateful Objects

Objects are stateful by default. This means that object value is evaluated on each request. The exceptions are variables and arrays.

Now, any object can be made stateful. For that a keep value (\\) operator can be used. The value of stateful object is evaluated at most once. The evaluated value is cached inside the object and returned on subsequent value requests.

The object statefulness is inherited. So, any object derived from the stateful object is stateful too.

Assignment Statements

A binding statement (<-) is used now to assign new values to variables or for custom assignments. It does exactly what former variable assignment (=) statement did before.

The equal sign is used for value assignment statement now, which is an enhanced version of assignment. It does the following:

  • makes the value object stateful (just like a keep value operator),
  • evaluates its value, and
  • assigns it to the target (just like a binding statement).

This makes the assignment to behave more traditionally for imperative programming languages.

The combined assignment statements (+=, -=, *=, /=) known from C have been added to o42a to reduce the boilerplate. Now, a loop can be written like this:

``0 $ i {
  I += 1
  Print [i] '/10' nl ~~ `1/10` ... `10/10`
  I < 10?...
}