[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
...
In short, I think you have confused the structure of names [in this case,
CL symbols] with their use.
I think you are confusing YOUR semantics of CL (which may be
widespread (Moon seems to share your view of SYMBOLs as being
componentles)s) with the semantics actually described in CLtL. I
personally find the concept of "atomic" (as opposed to composite) a
useless one in CL. I think CLtL agrees; it has virtually eliminated
the notion of "atomic". Look at the definition of ATOM on pg. 73 ("is
not a CONS"); it says nothing about the notion of atominicity. How
sensible is it to view an array as "atomic"?
And this brings up the second example of the confusion in constant
folding that no one has yet addressed: Why are lists and strings
(among others) constant folded, but not general vectors, since all of
them are composite objects? I know the answer in CLtL (two non-EQ
general vectors are not EQUAL (this is the same reason SYMBOLs aren't
folded)); what I want to know is how much sense does this distinction
make? For example, according to my understanding of the
constant-folding rule:
[1] (EQ (QUOTE #1=(gensym)) (QUOTE #1#)) => must be T
[2] (EQ (QUOTE #1=#(1 2 3)) (QUOTE #1#)) => must be T
[3] (EQ (QUOTE #1=(1 2 3)) (QUOTE #1#)) => T or NIL, wow!!!!!
How much sense does the difference in behavior between [2] and [3] make?
Now, on the general issue of program "constants". PDP10 MacLisp would
"uniquify" constants into a read-only are at load time; other lisps do
similar things. I believe this is the intent of the few mumbling words
in CLtL about "constants". More importantly, this capability of
implementation is so important, and the hacks involved in permitting
runtime modification of constants are so un-useful, that CL should probably
confront the issue square on. ["un-useful", because the programmer's
intent is never more clear when using this hack than when using a more
approved way, such as a global parameter explicitly constructed up by
techniques like backquote or cons etc.]
If this "capability of implementation" is so important, why are so few
implementations taking advantage of it? I couldn't get Symbolics CL
(which I thought WOULD do it), Vax CL, or KCL to put a "constant" into
read-only space. What implementations DO put constants in RO space?
...
(defvar *constants-hashtable* (make-hash-table :test 'EQUAL))
(defun quote fexpr (x)
(let ((form (car x)))
(or (gethash *constants-hashtable* form)
(setf (gethash *constants-hashtable* form)
(purcopy form)))))
should be thought of as minimal definition.
As KMP pointed out, you are collapsing two behaviors into one special
form. A bad idea in this case. I will have more to say on this in my
reply to him.
...
[Of course, the hashtable wouldn't really be an
EQUAL table, as defined by CLtL, but something more akin to EQUALP. I
have seen the term COALESCABLEP used used. It's probably not important
just how much "collapsing" goes on.]
I hope CLtL would clean-up EQUAL to mean "collapsable" rather than
subject the poor Lisp novice to yet another slightly-different
equality predicate.
-- Nick