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

ambiguity in defgeneric and method descriptions



Page 2-29: the defgeneric section, the first two paragraphs under
Remarks:

The first paragraph is: 

"If a method already exists on the given generic function with the same
parameter specializers and the same qualifers, defgeneric replaces the
existing method with the one now being defined."

My question is, "the same as what?"  I suggest clarifying it along these
lines:

"If a method already exists on the given generic function with the same
parameter specializers and the same qualifers as any method description
given in this defgeneric form, that existing method is replaced with the
one now being defined."  

The second paragraph is:

"If ano method descriptions are specified and a generic function of the
same name does not already exist, a generic function with no methds is
created."

That makes perfect sense, but I think it brings up another point to
clarify.    What happens if no method descriptions are specified in this
defgeneric, but there is an existing generic function with methods?
Have we decided what happens then?   I don't remember any discussion
about it.

In the old days of defgeneric (before method descriptions), we said that 
no methods were affected when a generic function was redefined.    If
that still holds in the current scheme, the users might be faced with an
interesting pitfall.    If the old defgeneric included a method
description and the new one doesn't, then the Lisp world will contain a
method, but there won't be any source of that method.    

The alternative would be to follow the model of defclass; if the old 
defclass defined readers or accessors and the new defclass does not,
during the redefinition those old methods and generic functions go away.
We could make old methods that were defined by the :method option to
defgeneric go away, if the new defgeneric doesn't define those methods. 

Whichever one is right, it's worth another Remark.