[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: RMS at MIT-AI
- Subject: Re: &keywords
- From: George J. Carrette <GJC at MIT-MC>
- Date: Tue ,3 Feb 81 19:25:00 EDT
- Cc: LISP-FORUM at MIT-AI
I thought your destructuring suggestion was a nice replacement
for &keywords. Much simpler, and more general. I'll illustrate:
(DEFUN FOO ((SPECIAL X) Y Z (FLONUM Y) (VECTOR 3 K) (VECTOR REST M))
Now, DEFUN FOO says "have a function FOO which takes its arguments off
the stack." The argument list tells how to "take them off".
(SPECIAL X) ; bind the fluid variable X with the first argument.
Y ; lexical variables. might as well stay on stack, but this
Z ; does let the compiler choose register homes at will.
(FLONUM Y) ; give this guy a flonum home, making sure it is a flonum!
; or else it wouldn't fit in the home.
(VECTOR 3 K) ; take the next 3 arguments and have a lexical variable K
; point to them as a vector.
(VECTOR REST M) ; M gets a vector of the REST of the arguments.
(OPTIONAL Q) ; is not quite as pretty to implement, think about this one.
Now, I see what I have given as happening at a pretty low-level.
Things like SPECIAL declarations are handled as part of the USER-MACROLOGY,
which is not at this level.
Also, the form (QUOTE X) is not admitted in DEFUN. That kind of thing
is handled in a formalism developed for semantic description of the
system and extensions to the non-user level of the compiler. e.g.
(DEFEXT PUSH (X (QUOTE Y)) (SET Y (CONS X (EVAL Y))))
So, the question is, does this all make practical sense?
p.s. I've got a version of RMS's destructuring LET if anyone would
like to see it.