[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: firstname.lastname@example.org
- Subject: issue COMPILE-ARGUMENT-PROBLEMS
- From: email@example.com (Sandra J Loosemore)
- Date: Mon, 8 Aug 88 10:11:01 MDT
Here's the writeup -- comments, flames, etc. are welcome....
References: CLtL p. 438-439
Category: CLARIFICATION, CHANGE
Edit History: V1, Sandra Loosemore (8 Aug 1988)
The description of what arguments can legitimately be passed to the
function COMPILE in CLtL is too vague. There are two specific
(1) Acceptance of the FUNCTION-TYPE proposal makes it nonsensical to
speak of a lambda-expression being an interpreted function (it is not)
or to require a symbol to have a lambda-expression as its definition
(the SYMBOL-FUNCTION must be a true FUNCTION object).
(2) Many implementations cannot correctly compile functions that are
defined interpretively in a non-null lexical environment, because the
compiler and interpreter use different representations for closures.
Although this problem arose in conjunction with the
DEFINING-MACROS-NON-TOP-LEVEL proposal, the situation can also arise
if SETF is used to store a lexical closure in the SYMBOL-FUNCTION of
If the optional "definition" argument to COMPILE is supplied, it may
be either a lambda expression (which is coerced to a function) or a
function to be compiled. Otherwise, the SYMBOL-FUNCTION of the symbol
is extracted and compiled. It is an error if the function to be
compiled was defined interpretively in a non-null lexical environment,
or if it is already compiled.
Saying "it is an error" to try to compile the wrong kind of function
allows implementations that can compile functions defined in a
non-null lexical environment to go ahead and do so.
Implementations that do not allow sharing of lexical environments
between compiled and interpreted functions include VaxLisp, Allegro
CL, and Lucid. Lucid already accepts an interpreted function object
as the "definition" argument to COMPILE.
Cost to implementors:
Most of the changes required for this proposal are already necessary
to correctly implement the FUNCTION-TYPE proposal. The primary addition
is that COMPILE must be extended to accept a FUNCTION object as well
as a lambda expression as the "definition" argument.
Cost to users:
None. This is an upward-compatible change, since a lambda expression
can still be passed as an argument to COMPILE. Also, since most
existing implementations refuse to compile a function with a non-empty
lexical environment, user code which depends on being able to do this
is already nonportable.
An area of ambiguity in the language is resolved.
An alternative behavior when trying to COMPILE as function that is
already compiled would be to do nothing.