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

constant folding/smashing

re: Date: Mon, 13 Jun 88 02:31:18 EDT
    From: "Robert W. Kerns" <RWK@AI.AI.MIT.EDU>
    . . . 
        [jonl: Symbols are atomic, and don't have 'components']
    . . . 
    is the same as
    (SETQ X 1), for X being special.
    The X in either piece of code is a REFERENCE to a non-constant 
    object, shared between occurrances of read.  It is a PUBLIC structure 
    published by INTERN.  Modifications to its value cell are modifications 
    to the global variable environment.  They're already EQified as much as 
    makes sense.

If you had quoted my full message to which you are replying, there would
have been a reference to the several implemtations of Common Lisp that
do not implement special variables via a "component, value-cell".  It was
the explicit intent of the authors of CLtL that "deep binding" schemes not
be proscribed; your description quoted just above is a model for a shallow-
binding implementation.  As moon has also pointed out, one should not mistake
the accidents of a paritcular implementation for the underlying semantics of 
a construct.

Now, I will admit that Lisp'ers frequently speak of a symbol's value-cell,
or it's function cell; but this is language rooted in a now outdated past.
It's ok to use that language, so long as everyone understands that there
need not be an actual record structure with such components in it.  Remember
in VAX/NIL how the only implementation component was a "multiplex" cell,
which would lazily create an auxiliary four-component data structure when
necessary?  The term "value-cell" in that implementation was merely a
shorthand for a much more complex implementational scheme.

re: Date: 13 Jun 1988 18:50-EDT
    Sender: NGALL@G.BBN.COM
    . . . 
    If you want to suggest that the interpreter should be changed to make
    QUOTE return a RO-EQUAL-copy of its arg when possible*** (as I think JonL
    may have been suggesting?), then consider what a pain it will cause at
    the top-level:

    > (setf foo '(1 2 3))
    (1 2 3)
    > (push 0 foo)
    >>>>> Error ...

First off, you should re-examine the semantics of PUSH -- I think you will
find that it modifies the value of the variable FOO rather than the quoted
data structure of your example.  In virtually every implementation of CL,
(macroexpand-1 '(push 0 foo)) ==> (setq foo (cons 0 foo))

You may also want to remember the potential for read-only objects [which I 
think I discussed in a previous note -- Interlisp-D had read-only strings?]. 
I suppose it would almost be an acceptable implementation of QUOTE to make 
it's "argument" be a read-only object (when possible), rather than returning 
a non-EQ-but-EQUAL read-only copy; but I dislike this approach since it 
requires modifying the data-structure representing the program during the 
running of the program itself.

re:  All QUOTE can do [is] to cons in RO-space an EQUAL COPY of
    its argument and return that copy.  But there is NO SUCH THING as an
    EQUAL "COPY" of a hashtable.  It doesn't matter that its gross, it
    just won't work.

If you are referring to my "canonicalization" version of QUOTE, you should
recall that two "quoted" constants were coalesced *not* when they were
EQUAL, but under a more permissive predicate.  It is not an EQUAL copy
that one wants, but an "equivalent" one.  There are such things as
"coalescable" hash-tables, and they work quite well in Lucid Common Lisp;
I described their use in my note to Eliot dated Sat, 11 Jun 88 17:46:49 PDT.

-- JonL --

P.S.: That the "push" typo/braino should go unnoticed so long suggests that
      no one else is really reading these interchanges.  If anyone on the
      mailing list feels they are not useful interchanges (and is actually
      reading this post-script!), he should speak up now!