Sfairadora

  • Reference Guide

Constants NONE and INIT

Sfairadora defines two special types – None and Init. Both of them have only one value – NONE and INIT.
The constant NONE represents the state “no data”. Functions that do not return a value return formally this value.
The constant INIT represents the initial value of any type. There are data conversions defined from the type Init to every other data type. Such a conversion produces always the initial value of the target type. Therefore, using the constant INIT is equivalent to writing the initial value of a type, without the necessity to know what the type actually is. With an explicit typecast, it is possible to get the initial value for a given type (at this point, it should be noted that the typecast operator does not require the type to be specified as a constant expression – it can be computed dynamically).
The INIT constant can also be used for clearing the content of a sequence (the sequence will be present, but will not contain any element) or, on contrary, to create a value of a not-present optional data item:
document.data.table = INIT;