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

Re: generic-function special form



    Date: Wed, 4 May 88 18:59 PDT
    From: Gregor.pa@Xerox.COM

    There hasn't been enough conversation about this for us to converge.  In
    particular, Moon hasn't replied about whether or not he agrees that
    generic-function efunctuates the method-function bodies contained in it.

I'm more than a little behind on mail these days, and your question was
hard to answer since we're not communicating on the same wavelength, or
something.  See below.

    It seems to me that generic-function is like function.  It causes part
    of its body to be efunctuated.  It could be implemented as a macro and
    have the same effect, but I don't see why that is a good idea.

I don't understand why the fact that GENERIC-FUNCTION is like FUNCTION has
any bearing on the choice of whether it's documented as a macro or as a
special form.  The (somewhat quixotic in my opinion) grounds for making
this decision in Common Lisp are documented in CLtL p.57 paragraph 2.
I see no reason why a program understanding program would need to have
special knowledge of GENERIC-FUNCTION; as far as I can see, GENERIC-FUNCTION
can be macro expanded into a combination of functions and existing special
forms.

    Date: Fri, 29 Apr 88 14:25 PDT
    From: Gregor.pa

    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?

You didn't really think (FUNCTION (GENERIC-FUNCTION ...)) was any more
meaningful than (FUNCTION (MAKE-INSTANCE ...)), did you?  To pass a
generic function as an argument, one writes (GENERIC-FUNCTION ...), it
isn't necessary to put FUNCTION in front of it.  The documentation doesn't
have to say that a function or macro cannot be used inside the FUNCTION
special form, since LAMBDA is the only word that can be used that way.

Yes, the method bodies of GENERIC-FUNCTION capture the lexical scope
they are defined in, I believe (88-002 doesn't actually say).  If we
believe what 88-003 p.42 says (I think we've changed our mind a little
since this document was printed), then GENERIC-FUNCTION accomplishes
this lexical capturing with the METHOD-LAMBDA word.  In any case,
GENERIC-FUNCTION does it the same way that DEFMETHOD does.

    Date: 30 Apr 88 10:19 PDT
    From: Dick Gabriel <RPG@SAIL.Stanford.EDU>

    Similarly, I thought that
    folks would prefer to see GENERIC-FUNCTION be as similar to FUNCTION as
    possible.

Right.  I think Gregor's confusion was that he thought GENERIC-FUNCTION
should be as similar to LAMBDA as possible.

Unless I'm missing something, none of the arguments actually speak to the
issue of whether GENERIC-FUNCTION should be a macro or a special form.
Note that this decision has no semantic effect other than on code analyzing
programs.  I hate to spend any more time on this issue, however it seems
to me that our response to the criticism must be either "you're right,
we've changed it to a macro" or "we don't have time to think about this
so we left it alone."  I don't see a viable response of "you're wrong
for the following reason."