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

lambda list congruence

This question is based on CLOS Specification 88-002 (March 1988)

Congruent Lambda-Lists for ALL methods of a Generic Function (Page 1-29)

The requirements here seem to rule out the following:

I have a generic function, MOUSE-CLICK, and I want to insist that all 
invocations provide the following arguments:
a "window", a "button", a horizontal coordinate, a vertical coordinate, and
a timestamp.

I have two methods, whose lambda lists I would like to write as
m1)  ((w partitioned-inspector) (b (eql *middle-button*)) x y timestamp)
m2) ((w expandable-icon) &rest irrelevant)  (declare (ignore irrelevant))

Apparently, I must write m2 in a more onerous fashion, as
   ((w expandable-icon) b x y tm)  (declare (ignore b x y tm))

It appear I have more flexibility if I am willing to set up my protocol
to use keyword, rather than positional, parameters, but that isn't always
practical, and, besides, I absolutely LOSE the ability to express that the
arguments are REQUIRED (common lisp, unfortunately, has no notion of
a required keyword parameter).  I would have to introduce supplied-p
parameters and test them (in each method) to ensure that no callers 
could get away with omitting some of the arguments.

What I would like is the ability to have the generic function's lambda
list be even MORE RESTRICTIVE than those of (some of) its methods, rather
than the stronger CONGRUENCE requirement stated in the specification.
Another way of stating this is that I would prefer a requirment that
all methods have lambda lists that are compatible with, but not 
necessarily congruent with, that of the generic function.
Where does this break down?  [I would certainly be willing to
always specify my generic function lambda list BEFORE I wrote any
methods with lambda lists that were less restrictive.]