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

[no subject]



I also think that DEFSUBST and the like is a total crock.  Doing
real open-coded functions is the right answer.  It takes all of 5
lines of code in GLS's S-1 compiler (S1COMP) to handle open
functions; basically if you do
	(DEFUN-OPEN SECOND (X) (CADR X))
the
	(SECOND mumble)
turns into
	((LAMBDA (X) (CADR X)) mumble)
And that's it.  This will "work" in any compiler I know of,
though it will only be efficient if the compiler knows how to
toss LAMBDA's around (as S1COMP does).  However, that's as things
should be, the compiler should do these things (i.e. substitute
for lambda variables) rather than the user; the compiler will get
it right, at least.  Also, using LAMBDA extensively can eliminate
possible naming conflicts.  E.g. I believe LISPM code could lose
if it used *L* in a SOME or EVERY, or *SELECT-ITEM* in a SELECTQ.

[Note: the above implementation isn't 100% accurate, as S1COMP
actually processes the (LAMBDA (X) (CADR X)) in a null lexical
environment so that the free variables in the lambda-body (none
in this case) actually refer to globals and not to variables
lexically apparent at the invokation, but that's not very hard.]