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

Issue: LOAD-TIME-EVAL, Sub-Issue: Displacing macros



Personally, I can't imagine how displacing macros can work at all.

The absence of user primitives for detecting which objects are read-only
means that user-written displacing macros must run up head-to-head with the
problem that they might displace quoted structure. Consider:

 (DEFMACRO MYLET (&WHOLE FORM BVL &BODY FORMS)
   (LET ((RESULT `((LAMBDA ,(MAPCAR #'CAR BVL) ,@FORMS)
                   ,@(MAPCAR #'CADR BVL))))
     (SETF (CAR FORM) (CAR RESULT))
     (SETF (CDR FORM) (CDR RESULT))
     FORM))

 (EVAL '(MYLET ((X 3)) (+ X X)))

might end up losing due to displacing constant structure [the quoted
expression given to EVAL].

That leaves only system displacement. And I've always felt displacement was
so controversial that no user base would put up with it simply being dumped
on them. Rel6 of Symbolics Genera decided to displace just a few forms [LET,
LAMBDA, DO, ...] and it caused massive outcries from customers because it
broke all kinds of code. Symbolics withdrew the `feature' in Rel7.
The only way I can imagine people living with it is if they grew up with it,
but since it's a given that people in other environments didn't grow up with
it, then most portable code [I suspect] is not ready to deal with it.

There's actually one other option: The system provides a switch so you can
enable the `feature' if you want it. That reduces to the same, though,
because you just can't let users unilaterally set a variable [or whatever]
to change the semantics of the running Lisp for his application's needs and
expect that all the supporting libraries that he wrote will just continue
to function normally. It may be that the only reason that the switch has not
been set already is that one of those libraries left it off for a reason.

More and more these days I'm left with the feeling that all option variables
should be handled by vote. People (i.e., code modules) should identify their
preferrences without erradicating pre-declared preferences. As long as there
are no conflicts, the requested options should be permitted. But if there
is a conflict, the system should throw up its arms in dispair rather than
try to arbitrarily side with one faction or another. If we did this, I think
it would become quickly apparent that displacing macros were a thing we
should eliminate because no one would be able to figure out how to use them
in any serious way.

But this whole sub-issue aside, all we're really saying is that LOAD-TIME-VALUE
should not be done by displacing.