Pre-Defined Values
There are four pre-defined values in SIMPOL, two of which can be applied to
to every type, and two that are specific to the boolean type.
These values are: .true
, .false
,
.nul
, and .inf
. The first two have
been discussed in the section on the boolean type. The latter two can be
applied to all value types and .nul
can be applied to all
types, both value and object types. The value .inf
stands
for infinity. It has many similarities to the .nul
value
and in some cases it is converted to that value if there is no available
value to represent infinity, such as in SQL. The infinity
that is represented in SIMPOL is both positive and negative infinity, but
there is no value that represents infinitesimal (1 divided by infinity).
In fact, in SIMPOL 1 / .inf is equal to
.nul
.
It is important to understand how the two special values,
.nul
and .inf
are used within SIMPOL
and how their very existence in the language plays a role in how programs
written in it may or may not work as expected. The first of the two values,
.nul
is used in many places as a return value and also
it is the default value of a variable that has been created but not yet
been initialized with a value. Having the concept of a null value in the
programming language is quite useful, especially when interacting with
databases where the desire to retain the characteristic of an empty field
within a calculation may be desirable. The null value in SIMPOL follows
some fairly clear rules. The value .nul
combined with
any other value or values results in the value .nul
. If
in your program you are suddenly finding an unexpected null result, then
chances are that somewhere a value was uninitialized (or a database field
is empty).