Previous

2.1.3. Values

2.1.3.1. Plain values

a) A plain value is either an "arithmetic value", i.e., an "integer" or a "real number", or is a "truth value" {f}, a "character" {g}or a "void value" {h}.

b) An arithmetic value has a "size", i.e., an integer characterizing the degree of discrimination with which it is kept in the computer.

c) The mode of an integer or of a real number of size n is, respectively, some 'SIZETY integral' or 'SIZETY real' where, if n is positive (zero, negative), that 'SIZETY' is n times 'long' (is empty, is -n times 'short').

d) The number of integers or of real numbers of a given size that can be distinguished increases (decreases) with that size until a certain size is reached, viz., the "number of extra lengths" (minus the "number of extra shorths") of integers or of real numbers, respectively, {10.2.1.a, b, d, e } after which it is constant.

{Taking Three as the subject to reason about -A convenient number to state-}

e) For the purpose of explaining the meaning of the widening coercion and of the operators declared in the standard-prelude, the following properties of arithmetic values are assumed:

f) A "truth value" is either "true" or "false". Its mode is 'boolean'.

{Then subtract Seventeen, and the answer must be Exactly and perfectly true. The Hunting of the Snark, Lewis Carroll.}

g) Each "character" is "equivalent" to a nonnegative integer of size zero, its "integral equivalent" {10.2.1.n }; this relationship is defined only to the extent that different characters have different integral equivalents, and that there exists a "largest integral equivalent" {10.2.1.p }. The mode of a character is 'character'.

h) The only "void value" is "empty". Its mode is 'void'.

{The elaboration of a construct yields a void value when no more useful result is needed. Since the syntax does not provide for void-variables, void-identity-declarations or void-parameters, the programmer cannot make use of void values, except those arising from uniting {6.4 }.}

i) The scope of a plain value is the scope of the primal environ {2.2.2.a }.

2.1.3.2. Names

{What's in a name? that which we call a rose By any other name would smell as sweet. Romeo and Juliet, William Shakespeare.}

a) A "name" is a value which can be "made to refer to" {d, 5.2.3.2.a , 5.2.1.2.b } some other value, or which can be "nil" {and then refers to no value}; moreover, for each mode beginning with 'reference to', there is exactly one nil name of that mode.

A name may be "newly created" {by the elaboration of a generator {5.2.3.2 } or a rowed-to-FORM {6.6.2}, when a stowed name is endowed with subnames {2.1.3.3.e , 2.1.3.4.g } and, possibly, when a name is "generated" {2.1.3.4.j, l } }. The name so created is different from all names already in existence.

{A name may be thought of as the address of the storage cell or cells, in the computer, used to contain the value referred to. The creation of a name implies the reservation of storage space to hold that value.}

b) The mode of a name N is some 'reference to MODE' and any value which is referred to by N must be "acceptable to" {2.1.3.6.d } that 'MODE'. If 'MODE' is some 'STOWED', then N is said to be a "stowed name".

c) The scope of a name is the scope of some specific environ {usually the "local environ" {5.2.3.2.b } of some generator} . The scope of a name which is nil is the scope of the primal environ {2.2.2.a }.

d) If N is a stowed name referring to a structured (multiple) value V {2.1.3.3 , 2.1.3.4}, and if a subname {2.1.2.g } of N selected {2.1.3.3.e, 2.1.3.4.g } by a 'TAG' (an index) I is made to refer to a {new} value X, then N is made to refer to a structured (multiple) value which is the same as V except for its field (element) selected by L which is {now made to be} X.

{For the mode of a subname, see 2.1.3.3.d and 2.1.3.4.f.}

2.1.3.3. Structured values

a) A "structured value" is composed of a sequence of other values, its "fields", each of which is "selected" {b}by a specific 'TAG' {9.4.2.1.A }. {For the selection of a field by a field-selector, see 2.1.5.g .}

{The ordering of the fields of a structured value is utilized in the semantics of structure-displays {3.3.2.b } and format-texts {10.3.4 }, and in straightening {10.3.2.3.c}.}

b) The mode of a structured value V is some 'structured with FIELDS mode'. If the n-th 'FIELD' enveloped by that 'FIELDS' is some 'MODE field TAG', then the n-th field of V is "selected" by 'TAG' and is acceptable to {2.1.3.6.d } 'MODE'.

c) The scope of a structured value is the newest of the scopes of its fields.

d) If the mode of a name N {referring to a structured value} is some 'reference to structured with FIELDS mode', and if the predicate 'where MODE field TAG resides in FIELDS' holds {7.2.1.b, c }, then the mode of the subname of N selected {e}by 'TAG' is 'reference to MODE'.

e) When a name N which refers to a structured value V is "endowed with subnames" {e, 2.1.3.4.g , 4.4.2.b, 5.2.3.2.a }, then,

For each 'TAG' selecting a field F in V,

· a new subname M is created of the same scope as N;

· M is made to refer to F;

· M is said to be the name "selected" by 'TAG' in N;

· if M is a stowed name {2.1.3.2.b }, then it is itself endowed with subnames {e, 2.1.3.4.g }.

2.1.3.4. Multiple values

a) A "multiple value" {of n dimensions} is composed of a "descriptor" and a sequence of other values, its "elements", each of which may be "selected" by a specific n-tuple of integers, its "index".

b) The "descriptor" is of the form

((l1, u1),(l2, u2), ... , (ln, un)) where each (li, ui), i = 1, ... ,n, is a "bound pair" of integers in which li is the i-th "lower bound" and ui is the i-th "upper bound".

c) If for any i, i = 1, ... , n, ui < li, then the descriptor is said to be "flat" and there is one element, termed a "ghost element" {, and not selected by any index; see also {5.2.1.2.b } } ; otherwise, the number of elements is (u1 - l1 + 1) ×(u2 - l2 + 1) ×... ×(un - ln + 1) and each is selected by a specific index r1, ... , rn where li <= ri <= ui, i = 1, ... , n.

d) The mode of a multiple value V is some 'ROWS of MODE', where that 'ROWS' is composed of as many times 'row' as there are bound pairs in the descriptor of V and where each element of V is acceptable to {2.1.3.6.d } that 'MODE'.

{For example, given [ ] UNION (INT, REAL) ruir = (1, 2.0), the mode of the yield of ruir is 'row of union of integral real mode', the mode of its first element is 'integral' and that of its second element is 'real'.}

e) The scope of a multiple value is the newest of the scopes of its elements, if its descriptor is not flat, and, otherwise, is the scope of the primal environ {2.2.2.a }.

f) A multiple value, of mode 'ROWS of MODE', may be referred to either by a "flexible" name of mode 'reference to flexible ROWS of MODE1', or by a "fixed" name of mode 'reference to ROWS of MODE1' where {in either case} 'MODE1' "deflexes" {2.1.3.6.b } to 'MODE'.

{The difference implies a possible difference in the method whereby the value is stored in the computer. The flexible case must allow a multiple value with different bounds to be assigned {5.2.1.2.b } to that name, whereas the fixed case can rely on the fact that those bounds will remain fixed during the lifetime of that name. Note that the "flexibility" is a property of the name; the underlying multiple value is the same value in both cases.}

If the mode of a name N {referring to a multiple value} is some 'reference to FLEXETY ROWS of MODE', then the mode of each subname of N is 'reference to MODE'.

g) When a name N which refers to a multiple value V is "endowed with subnames" {g, 2.1.3.3.e , 4.4.2.b, 5.2.1.2.b , 5.2.3.2.a}, then,

For each index selecting an element E of V,

{In addition to the selection of an element {a}or a name {g}by means of an index, it is also possible to select a value, or to generate a new name referring to such a value, by means of a trim {h, i, j}or a 'TAG' {k, l}. Both indexes and trims are used in the elaboration of slices {5.3.2.2 }.}

h) A "trim" is an n-tuple, each element of which is either an integer {corresponding to a subscript} or a triplet (l, u, d) {corresponding to a trimmer or a revised-lower-bound-option} , such that at least one of those elements is a triplet {if all the elements are integers, then the n-tuple is an index {a}}. Each element of such a triplet is either an integer or is "absent".

{A trim (or an index) is yielded by the elaboration of an indexer {5.3.2.2.b }.}

i) The multiple value W {of m dimensions} "selected" by a trim T in a multiple value V {of n dimensions, 1 <= m <= n} is determined as follows:

j) The name M "generated" by a trim T from a name N which refers to a multiple value V is a {fixed} name, of the same scope as N, {not necessarily newly created} which refers to the multiple value W selected {i}by T in V. Each subname of M, as selected by an index IW, is one of the {already existing} subnames of N, as selected by an index IV, where each IV is determined from T and the corresponding IW using the method given in the previous sub-section.

k) The multiple value W "selected" by a 'TAG' in a multiple value V {each of whose elements is a structured value} is composed of

  1. the descriptor of V, and
  2. the fields selected by 'TAG' in the elements of V, where the element, if any, selected in W by an index I is the field selected by 'TAG' in the element of V selected by I.

l) The name M "generated" by a 'TAG' from a name N which refers to a multiple value V {each of whose elements is a structured value} is a {fixed} name, of the same scope as N, {not necessarily newly created} which refers to the multiple value selected {k}by 'TAG' in V. Each subname of M selected by an index I is the {already existing} name selected {2.1.3.3.e } by 'TAG' in the subname of N selected {g}by I.

2.1.3.5. Routines

a) A "routine" is a scene {2.1.1.1.d } composed of a routine-text {5.4.1.1.a,b } together with an environ {2.1.1.1.c }.

{A routine may be "called" {5.4.3.2.b }, whereupon the unit of its routine-text is elaborated.}

b) The mode of a routine composed of a PROCEDURE-routine-text is 'PROCEDURE'.

c) The scope of a routine is the scope of its environ.

2.1.3.6. Acceptability of values

a) {There are no values whose mode begins with 'union of'. There exist names whose modes begin with 'reference to union of', e.g., u in UNION(INT, REAL) u; . Here, however, u, whose mode is 'reference to union of integral real mode', refers either to a value whose mode is 'integral' or to a value whose mode is 'real'. It is possible to discover which of these situations obtains, at a given moment, by means of a conformity-clause {3.4.1.q }.}

The mode 'MOID' is "united from" the mode 'MOOD' if 'MOID' is some 'union of MOODSETY1 MOOD MOODSETY2 mode'.

b) {There are no values whose mode begins with 'flexible'. There exist flexible names whose modes begin with 'reference to flexible', e.g., a1 in FLEX [1: n] REAL a1; . Here a1, whose mode is 'reference to flexible row of real', refers to a multiple value whose mode is 'row of real' (see also 2.1.3.4.f ). In general, there exist values only for those modes obtainable by "deflexing".}

The mode 'MOID1' "deflexes" to the mode 'MOID2' if the predicate 'where MOID1 deflexes to MOID2' holds {4.7.1.a, b, c }.

{The deflexing process obtains 'MOID2' by removing all 'flexible's contained at positions in 'MOID1' where they are not also contained in any 'REF to MOID3'. Thus

'structured with flexible row of character field letter a mode', which is not the mode of any value, deflexes to

'structured with row of character field letter a mode'which is therefore the mode of a value referable to by a flexible name of mode

'reference to structured with flexible row of character field letter a mode'. This mode is already the mode of a name and therefore it cannot be deflexed any further.}

c) {There are no names whose mode begins with 'transient reference to'.

The yield of a transient-reference-to-MODE-FORM is a "transient name" of mode 'reference to MODE', but, there being no transient-reference-to-MODE-declarators in the language {4.6.1 }, the syntax ensures that transient names can never be assigned, ascribed or yielded by the calling of a routine.

E.g., xx := a1 [i] is not an assignation because xx is not a reference-to-transient-reference-to-real-identifier. Transient names originate from the slicing, multiple selection or rowing of a flexible name.}

d) A value of mode M1 is "acceptable to" a mode M2 if

  1. M1 is the same as M2, or
  2. M2 is united {a}from M1 {thus the mode specified by UNION(REAL, INT) accepts values whose mode is that specified by either REAL or INT} , or
  3. M2 deflexes {b}to M1 {thus the mode 'flexible row of real' (a mode of which there are no values) accepts values such as the yield of the actual-declarer FLEX [1 : n] REAL which is a value of mode 'row of real'} , or
  4. M1 is some 'reference to MODE' and M2 is 'transient reference to MODE' {thus the mode 'transient reference to real' accepts values (such as the yield of a1 [i]) whose mode is 'reference to real'} .
{See 2.1.4.1.b for the acceptability of the yield of a scene.}
 
Next