[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
issue CONSTANT-COLLAPSING, version 3
- To: email@example.com
- Subject: issue CONSTANT-COLLAPSING, version 3
- From: firstname.lastname@example.org (Sandra J Loosemore)
- Date: Tue, 3 Jan 89 14:02:35 MST
Only minor tweaks here, to clarify the relationship of this proposal to
issues CONSTANT-COMPILABLE-TYPES and QUOTE-MAY-COPY.
References: CLtL p. 78, 87
Edit History: V1, 07 Nov 1988, Sandra Loosemore
V2, 12 Dec 1988, Sandra Loosemore
V3, 03 Jan 1989, Sandra Loosemore
CLtL states that an implementation is permitted to "collapse" or
coalesce constants appearing in code to be compiled if they are EQUAL.
The definition of EQUAL does not permit coalescing of more general
isomorphic data structures (such as arrays and structures), which is
Issue QUOTE-MAY-COPY deals with whether coalescing may be performed
only by COMPILE-FILE, or by COMPILE and EVAL as well. CLtL says: "An
object is considered to be a constant in code to be compiled if it is
a self-evaluating form or contained in a QUOTE form".
State the an implementation is permitted to "collapse" constants
appearing in code to be compiled if they are equivalent under the
relationship specified in issue CONSTANT-COMPILABLE-TYPES.
There is little reason why implementations should not be allowed to
perform more general collapsing of structures, since the arguments
against doing so also apply to collapsing of EQUAL structures, which
is already permitted.
Both PSL/PCLS and A-Lisp collapse isomorphic arrays and structures,
and certain other data types that are defined internally as structures
(RANDOM-STATEs, for example). Lucid Common Lisp also uses a more
general coalescing predicate than EQUAL.
Cost to implementors:
None. This extends the range of permitted behavior for
implementations but does not require any implementation to change.
Cost to users:
It is hard to imagine a program that would break under this proposal.
The EQL-ness or uniqueness of composite structures in compiled code
cannot be guaranteed in any event, since the combination of
COMPILE-FILE and LOAD generally results in a copy of the original
Collapsing of isomorphic arrays and structures may lead to significant
memory savings in some applications.
This proposal depends heavily on issue CONSTANT-COMPILABLE-TYPES.
Some people believe that if the definition of EQUAL weren't "broken",
there wouldn't be any need for this proposal.
There is no inherent reason why the "coalescing predicate" must be the
same as the relationship used by the compiler/loader to construct
equivalent copies of objects of constants, but making the same rules
be applied in both situations simplifies the language somewhat.