Re: [CLOS] Ensuring a method exists
- From: Pascal Costanza <pc@xxxxxxxxx>
- Date: Thu, 28 Sep 2006 08:27:05 +0200
Didier Verna wrote:
It was after a discussion with a friend about the problems of binary
methods in traditional objects systems. I was playing with the idea and trying
to see how those problems could be solved with CLOS.
Taking Wade's recent comment into account, that it is questionable why methods for all classes must exist, here is another rule that could be more useful: In a binary function, it could be useful to check that methods are always specialized on both arguments and always for the same classes. This could easily be checked in a method on add-method. Roughly like this:
(defclass binary-function (standard-generic-function)
()
(:metaclass funcallable-standard-class))
(defmethod add-method :before
((gf binary-function) method)
(assert (apply #'equal (method-specializers method))))
Any objections why one could want to break this requirement?
Pascal
--
My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
.
- References:
- [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Lars Rune Nøstdal
- Re: [CLOS] Ensuring a method exists
- From: Didier Verna
- Re: [CLOS] Ensuring a method exists
- From: Ken Tilton
- Re: [CLOS] Ensuring a method exists
- From: Didier Verna
- [CLOS] Ensuring a method exists
- Prev by Date: Re: (read-from-string "#.(values) 42")
- Next by Date: Re: [CLOS] Ensuring a method exists
- Previous by thread: Re: [CLOS] Ensuring a method exists
- Next by thread: Re: [CLOS] Ensuring a method exists
- Index(es):