Download Larceny User Manual

Transcript
Larceny User Manual
(procedure-ref procedure offset) => object
(procedure-set! procedure offset object) => unspecified
These procedures operate on the representations of procedures and allow user programs to construct,
inspect, and alter procedures.
Procedure procedure-copy
(procedure-copy procedure) => procedure
Returns a shallow copy of the procedure.
The procedures above are deprecated because they violate abstraction barriers and make your code
representation-dependent; they are useful mainly to Larceny developers, who might otherwise be tempted
to write some low-level operations in C or assembly language.
The rest of this section describes some procedures that reach through abstraction barriers in a more
controlled way to extract heuristic information from procedures for debugging purposes.
Note
The following text is copied from a straw proposal authored by Will Clinger and sent to
rrr-authors on 09 May 1996. The text has been edited lightly. See the end for notes about the
Larceny implementation.
The procedures that extract heuristic information from procedures are permitted to return any result
whatsoever. If the type of a result is not among those listed below, then the result represents an
implementation-dependent extension to this interface, which may safely be interpreted as though no
information were available from the procedure. Otherwise the result is to be interpreted as described
below.
Procedure procedure-arity
(procedure-arity proc)
Returns information about the arity of proc. If the result is #f, then no information is available. If the
result is an exact non-negative integer k, then proc requires exactly k arguments. If the result is an inexact
non-negative integer n, then proc requires n or more arguments. If the result is a pair, then it is a list of
non-negative integers, each of which indicates a number of arguments that will be accepted by proc; the
list is not necessarily exhaustive.
Procedure procedure-documentation-string
(procedure-documentation-string proc)
Returns general information about proc. If the result is #f, then no information is available. If the result is
a string, then it is to be interpreted as a "documentation string" (see Common Lisp).
Procedure procedure-name
(procedure-name proc)
Returns information about the name of proc. If the result is #f, then no information is available. If the
36