A locative is an object that points to an element of a containing object, much like a pointer in low-level, imperative programming languages like C. The element can be accessed and changed indirectly, by performing access or change operations on the locative. The container object can be computed by calling the location->object procedure.

Locatives may be passed to foreign procedures that expect pointer arguments. The effect of creating locatives for evicted data (see object-evict) is undefined.

Creates a locative that refers to the element of the non-immediate object OBJ at position INDEX. OBJ may be a vector, pair, string, blob, SRFI-4 number-vector, or record structure. INDEX should be a fixnum. INDEX defaults to 0.

Returns a copy of the procedure PROCEDURE which contains an additional data slot initialized to X. If PROCEDURE is already an extended procedure, then its data slot is changed to contain X and the same procedure is returned. Signals an error when PROCEDURE is not a procedure.

Copies BYTES bytes of memory from FROM to TO. FROM and TO may be strings, blobs, SRFI-4 number-vectors (see: @ref{Unit srfi-4}), memory mapped files, foreign pointers (as obtained from a call to foreign-lambda, for example), tagged-pointers or locatives. if BYTES is not given and the size of the source or destination operand is known then the maximal number of bytes will be copied. Moving memory to the storage returned by locatives will cause havoc, if the locative refers to containers of non-immediate data, like vectors or pairs.

Copies the object X recursively into the memory pointed to by the foreign pointer object returned by ALLOCATOR, which should be a procedure of a single argument (the number of bytes to allocate). The freshly copied object is returned.

This facility allows moving arbitrary objects into static memory, but care should be taken when mutating evicted data: setting slots in evicted vector-like objects to non-evicted data is not allowed. It is possible to set characters/bytes in evicted strings or byte-vectors, though. It is advisable not to evict ports, because they might be mutated by certain file-operations. object-evict is able to handle circular and shared structures, but evicted symbols are no longer unique: a fresh copy of the symbol is created, so

As object-evict but moves the object at the address pointed to by the pointer-like object POINTER*. If the number of copied bytes exceeds the optional LIMIT then an error is signalled (specifically a composite condition of types exn and evict. The latter provides a limit property which holds the exceeded limit. Two values are returned: the evicted object and a new pointer pointing to the first free address after the evicted object.

Use of anything other than a pointer object as the POINTER* argument is questionable.

Returns the value of the global variable SYMBOL. If no variable under that name is bound, an error is signalled.

Note that it is not possible to access a toplevel binding with global-ref or global-set! if it has been hidden in compiled code via (declare (hide ...)), or if the code has been compiled in block mode.

Sets an internal hook that is invoked when a call to an object other than a procedure is executed at runtime. The procedure PROC will in that case be called with two arguments: the object being called and a list of the passed arguments.

Defines the value that is returned for unbound variables. Normally an error is signalled, use this procedure to override the check and return X instead. To set the default behavior (of signalling an error), call unbound-variable-value with no arguments.