[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dispatching on keywords
- To: Jonathan.Bachrach@ircam.fr
- Subject: dispatching on keywords
- From: davis@ilog.ilog.fr (Harley Davis)
- Date: Fri, 13 Nov 92 17:45:03 +0100
- Cc: info-dylan@cambridge.apple.com
- In-reply-to: Jonathan Bachrach's message of Fri, 13 Nov 1992 15:59:48 +0100 <199211131459.AA00220@miles.ircam.fr>
I think the idea of lexicographical ordering of class names for
computing method specificity is silly --- especially in a system where
class names are optional and documentary.
However, I think there is something which can be saved from the idea
of dispatching on keywords and optional arguments. I think it should
be allowed only if the default value is specified in the generic
function definition rather than in the method definition. This would
not create the sort of ambiguities which Moon and Fahlman mentioned.
My proposal would be that if a default value is specified in a generic
function, it cannot also be specified in one of the gf's methods. If
any method specifies a default value, the generic function cannot.
Example:
(defgeneric foo (x #optional (y 1))
(defmethod foo (x #optional (y <integer>))
;; default method
)
(defmethod foo (x #optional (y <string>))
;; could be called if y were supplied by the caller
)
Obviously there are major syntactic problems to be solved.
Also, for the question on ambiguous CPL's:
(defclass <w> (<x> <y>) ...)
(defclass <v> (<y> <x>) ...)
The CPL's for <w> and <v> have <y> and <x> in opposite orders. It is
not necessary that <y> and <x> be related to each other by
inheritance.
-- Harley Davis
------------------------------------------------------------------------------
nom: Harley Davis ILOG S.A.
net: davis@ilog.fr 2 Avenue Gallie'ni, BP 85
tel: (33 1) 46 63 66 66 94253 Gentilly Cedex, France