[closer-devel] Introducing new "type" classes

Michael Weber michaelw+closer at foldr.org
Sat Feb 16 17:14:57 UTC 2008


On Feb 16, 2008, at 17:17 , Pascal Costanza wrote:

> For pragmatic purposes, a compromise could be to have a two-step  
> process: Base the applicability on classes and eql-specializers,  
> and then use a filter to get rid of methods you actually don't  
> want. A method definition could then look like this:
>
> (defmethod* foo ((x integer))
>   (:filter (x (integer 1 10)))
>   ...)
>
> Maybe this could be added as new qualifiers and the filtering could  
> then be part of a user-defined method combination. This would then  
> be portable.
>
> However, I don't know how much this would be an improvement over this:
>
> (defmethod foo ((x integer))
>   (unless (typep x '(integer 1 10))
>     (return-from foo (call-next-method)))
>   ...)
>
> [These thoughts are a bit random, sorry for that. But they are a  
> rough summary of my views on this issue I have developed so far...]

A generalization of the above would be predicate dispatch:
* Ernst et al: "Predicate Dispatching: A Unified Theory of Dispatch"   
<http://citeseer.ist.psu.edu/ernst98predicate.html>
* Ucko: "Predicate Dispatching in the Common Lisp Object System"  
<http://citeseer.ist.psu.edu/526172.html>

I forgot what Ucko does about the specificity issue.


Cheers,
Michael




More information about the closer-devel mailing list