[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

issue CONSTANT-COLLAPSING, version 2

The change on this one is to make coalescing use the same rules as

References:	CLtL p. 78, 87
Category:	CHANGE
Edit History:   V1, 07 Nov 1988, Sandra Loosemore
		V2, 12 Dec 1988, Sandra Loosemore

Problem Description:

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
often desirable.


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.

Current Practice:

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.


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.