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

Re: generic-function special form



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.

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.

To make things simpler for people who may not have the old messages
filed, here are all the messages I have on this topic:


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

    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?


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

    On GENERIC-FUNCTION special form:

    It's true I proposed it to be a special form. I did that so it
    would be parallel to FUNCTION. I had even imagined some #<mumble>
    reader macro for it. Unlike FUNCTION, GENERIC-FUNCTION can be a macro
    for MAKE-INSTANCE.  In Qlisp we have a macro called QLAMBDA which is
    like LAMBDA except it cannot be used inside FUNCTION etc.  It turns out
    to be a drag because the differences between how you can use QLAMBDA
    and how you can use LAMBDA seem gratuitous. Similarly, I thought that
    folks would prefer to see GENERIC-FUNCTION be as similar to FUNCTION as
    possible.

    GENERIC-FUNCTION as a macro can efunctuate what it needs to inside the
    #'lambda's that appear inside the method-forming part of the expansion of
    the macro. I can imagine people making mistakes the first time they write
    this macro.


    Date: Mon, 2 May 88 08:58:20 CDT
    From: Patrick H Dussud <DUSSUD@Jenner.csc.ti.com>

    I think that a macro will work. A macro can return a form that capture
    the lexical environment if it contains lambda forms.


    Date: Mon, 02 May 88 08:54:39 -0700
    From: kempf@Sun.COM

    Arguments on the side of making it a special form are those cited by RPG
    and Gregor, namely that consistency between the way function and 
    generic-function work seems like a good idea (RPG's qlambda example) and
    the need for capturing the lexical environment (Gregor). On the minus
    side is the stated goal of Common Lisp to limit the number of special
    forms and the obvious macroexpansion for generic-function.

    I tend to think that generic-function should be a special form, for
    the arguments cited, and because it seems like a different enough
    piece of functionality to justify going beyond the goal of limiting
    special forms.
-------