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

RMS's DISPLACE



Not to be contrary, but the most common complaint against
DISPLACE (and this includes the one for which RMS vouches
"winning in all respects") is that it fails to error out
if given an atom.   But as regards whether or not to have
DISPLACE act as currently in MACLISP, or to install the
DISPLACED marker, I prefer the current.  For example, 
RMS's scheme can be implemented using the current DISPLACE:
(DEFUN SDISPLACE (X Y) 
       (DISPLACE X (LIST 'DISPLACED (CONS (CAR X) (CDR X)) Y)))
(DEFUN DISPLACED MACRO (X) (CADDR X))
But for the ocasional user who tries out DISPLACE in a way that
we didn't conceive, it will be very difficult to get around
the extra stuff stuck in by StallmanDISPLACE.  E.g.,
(DEFUN CELL-EXCH (X Y) 
       (LET ((X` (CONS (CAR X) (CDR X))))
            (DISPLACE X Y)
            (DISPLACE Y X`)))
The intent of similar usage would be defeated if the DISPLACED
marker kept getting pushed onth the head of the cell.
    Whereas the primary use of DISPLACE will probably be for
macro-expansion shunting, the current definition does not presume
that;  RMS's one does.  In either case, the compiler has to
override the SUBR definition by some macro trap similar to
(DEFUN DISPLACE MACRO (FUNNY-SYMBOL/|)
       (LIST 'QUOTE (EVAL (CADDR FUNNY-SYMBOL/|))))
or possibly by special-case trap to extract the "Y" part
as if it were the original expression.
   At any rate, StallmanDISPLACE deserves to be added to the big
bag of MACRO tricks, of which there are right now 
1) none in the interpreter, and
2) many floating around, such as on LIBLSP
Perhaps we need some more canonical place to put winning MACROs.