[Ecls-list] LOAD-TIME-VALUE and literal object externalisation.
Samium Gromoff
_deepfire at feelingofgreen.ru
Tue Apr 22 20:15:29 UTC 2008
At Tue, 22 Apr 2008 21:26:54 +0200,
Juan Jose Garcia-Ripoll wrote:
>
> On Tue, Apr 22, 2008 at 7:58 PM, Samium Gromoff
> <_deepfire at feelingofgreen.ru> wrote:
> > It seems I've discovered yet another angle which makes it fail:
>
> You are trying to create a binary with a hash table. I am not sure
> this can be done or is expected to work by the ANSI standard. Does it
> work in CMUCL/SBCL? It would not be difficult to implement: you just
> have to write a method for MAKE-LOAD-FORM
I just checked, and yes, it works in SBCL -- in fact these test cases
come from minimisation of my spec-driven parser generator I'm trying
to port from SBCL..
Regarding the expectability of that wrt. ANSI, the relevant passages
seem to be 3.2.4.1 Externalizable Objects:
> An object that can be used as a literal object in code to be processed
> by the file compiler is called an externalizable object.
>
> We define that two objects are similar if they satisfy a two-place
> conceptual equivalence predicate (defined below), which is independent
> of the Lisp image so that the two objects in different Lisp images can be
> understood to be equivalent under this predicate. Further, by inspecting
> the definition of this conceptual predicate, the programmer can anticipate
> what aspects of an object are reliably preserved by file compilation.
<snip>
> The set of objects that are externalizable objects are those for which
> the new conceptual term ``similar'' is defined, such that when a compiled
> file is loaded, an object can be constructed which can be shown to be
> similar to the original object which existed at the time the file compiler
> was operating.
Under this definition, it /seems/ that hash-tables fall under externalizable
objects, as 3.2.4.2.2 defines ``similarity'' for them:
> hash-table
>
> Two hash tables S and C are similar if they meet the following three
> requirements:
>
> 1. They both have the same test (e.g., they are both eql hash tables).
>
> 2. There is a unique one-to-one correspondence between the keys of the
> two hash tables, such that the corresponding keys are similar.
>
> 3. For all keys, the values associated with two corresponding keys are
> similar.
>
> If there is more than one possible one-to-one correspondence between
> the keys of S and C, the consequences are unspecified. A conforming
> program cannot use a table such as S as an externalizable constant.
But, also, this raises another question -- functions are not defined
to be externalizable, yet we routinely store them in fasls?
Honestly, the line between literal and non-literal objects becomes
somewhat blurry in my head..
regards, Samium Gromoff
More information about the ecl-devel
mailing list