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

Aside about encapsulations



I just wrote an encapsulation package for Spice Lisp that can trace an
arbitrary setfable location.  The encapsulation is a closure that does all the
real work (normally, calling the encapsulation functions, but also adding and
deleting encapsulation functions and deleting itself).  Most implementations
could probably use this to encapsulate the expansion function for a macro [we
use (MACRO . <function>) on the function cell].  This encapsulation can wrap
the result of the expansion with arbitrary forms, in order to "encapsulate the
macro call."  [Probably not desirable, since compiled code would contain the
encapsulation...]  Someday soon I'll finish the job and write a trace package.

The thing about encapsulating special forms is that the encapsulation function
has to be a special form.  All the information could be stored elsewhere, but
you have to know which special form you're talking about.  I haven't
thought up a way to do this, unless we add closure special forms to the system
(looks hard) or the encapsulation function examines the stack (eeew grossss).
Anybody?

-- Steve