Next: scheme basic proper tail recursion, Previous: scheme basic unspecified behavior, Up: scheme basic [Index]
Variables and objects such as pairs, vectors, bytevectors, strings,
hashtables, and records implicitly refer to locations or sequences of
locations. A string, for example, contains as many locations as there
are characters in the string. (These locations need not correspond to a
full machine word.) A new value may be stored into one of these
locations using the string-set!
procedure, but the string
contains the same locations as before.
An object fetched from a location, by a variable reference or by a
procedure such as car
, vector-ref
, or string-ref
,
is equivalent in the sense of eqv?
to the object last stored in
the location before the fetch.
Every location is marked to show whether it is in use. No variable or object ever refers to a location that is not in use. Whenever this report speaks of storage being allocated for a variable or object, what is meant is that an appropriate number of locations are chosen from the set of locations that are not in use, and the chosen locations are marked to indicate that they are now in use before the variable or object is made to refer to them.
It is desirable for constants (i.e. the values of literal expressions)
to reside in read-only memory. To express this, it is convenient to
imagine that every object that refers to locations is associated with a
flag telling whether that object is mutable. Literal constants, the
strings returned by symbol->string
, records with no mutable
fields, and other values explicitly designated as immutable are
immutable objects, while all objects created by the other procedures
listed in this report are mutable. An attempt to store a new value into
a location referred to by an immutable object should raise an exception
with condition type &assertion
.
Next: scheme basic proper tail recursion, Previous: scheme basic unspecified behavior, Up: scheme basic [Index]