[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
generic-function special form
Date: Fri, 29 Apr 88 14:25 PDT
From: Gregor.pa@XEROX.COM
Subject: generic-function special form
One of the comments we received was:
Date: Fri, 15 Apr 88 13:43 PDT
From: David N Gray <Gray@DSG.csc.ti.com>
It is not apparent why GENERIC-FUNCTION needs to be a special form
instead of a macro.
Gregor said:
Because Common Lisp doesn't have lambda macros.
Moon said:
No, that's wrong, because GENERIC-FUNCTION is not something that can be
used inside the FUNCTION special form. In other words, GENERIC-FUNCTION
evaluates, it doesn't efunctuate. As far as I can see GENERIC-FUNCTION
could be a macro that expands into MAKE-INSTANCE <generic-function-class>
and a bunch of initargs including some that are forms that construct methods.
I think Gray is right on this one and it's a mistake in the document.
We should check with RPG, who proposed this.
Gregor said:
I am surprised to here that generic-function cannot be used inside the
function special form. It doesn't say that in the documentation, and
since the method bodies are supplied as forms, I think this must
efunctuate. It must capture the lexical scope it was used in or else
what is it worth?
What do others think?
-------
I think that a macro will work. A macro can return a form that capture
the lexical environment if it contains lambda forms.
Patrick.