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

re: DEFMETHOD with no required args?



[In reply to message from Gray@DSG.csc.ti.com sent Mon, 17 Jul 89 12:15:58 CDT.]

David Gray writes:

``My immediate reaction was "of course that isn't supposed to work", but I
can't find anywhere that 88-002R actually says that.  In particular, the
specialized lambda list syntax uses {...}* instead of {...}+ which
implies that there could be no required arguments.  Is this really
supposed to be permitted, or is it an oversight that it is not
explicitly prohibited?''

As one of the primary authors of 88-002R, it is not an oversight that
generic functions of 0 required arguments is permitted, and one reason
is that it strikes me that ``of course that is supposed to work.''

The question appears to hinge on a judgement of the form that unless some
particular feature has some ``reasonable use'' in a language, why permit
the feature?  A generic function of 0 arguments is primarily useful for
writing a program with a simple control structure based on the method
combination type specified.

The counter to the judgement is that regularity or consistency is also
important. For example, we do not prohibit addition of 0, even though
there is no use for it (coercion or normalization aside). So why make a
special case of 0 arguments?

Another approach to the problem is to maintain the belief that methods
are somehow attached to classes, and since a method on 0 arguments has
no classes for attachment, there can be no method. Already we need to
attach methods to sets of classes rather than individual classes,
so the empty set need not be a special case.

Finally, there may be an implementation reason to prohibit generic
functions of 0 arguments, but this reason is not interesting.

			-rpg-