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

dispatching on keywords

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.


(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

-- 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