[closer-devel] Re: [Ecls-list] Closer to MOP for ecl

Pascal Costanza pc at p-cos.net
Thu May 11 18:39:06 UTC 2006


On 11 May 2006, at 20:15, Gary King wrote:

> I'm not sure what to do. Some Lisps (such as OpenMCL and SBCL)  
> define eql-specializer as a class. Others (such as LispWorks) do  
> not (AFAICT). Also, I don't see eql-specializer-p being exported or  
> defined in Closer to MOP. It's used in ECL and LispWorks but not  
> defined. I think what I want is
>
>> (defgeneric eql-specializer-p (thing)
>>   (:documentation "If thing is an eql-specializer, returns a  
>> representation of thing as \(eql <object>\).")
>>   #-(or lispworks ecl)
>>   (:method ((thing eql-specializer))
>>            (list 'eql (eql-specializer-object thing)))
>>   (:method ((thing t))
>>            #-(or lispworks ecl)
>>            (values nil)
>>            #+(or lispworks ecl)
>>            (typep obj 'eql-specializer))
>>   #+digitool
>>   (:method ((thing cons))
>>            ;; don't ask, don't tell
>>            thing))
>
> comments?

The "correct" way is to implement eql specializers as a class, so  
there would be no need to implement eql-specializer-p because (typep  
thing 'eql-specializer) should already do what you want.

LispWorks and ecl are the only implementations that implement eql  
specializers as lists (wich, btw, better complies with ANSI Common  
Lisp, but that's another story). LispWorks provides eql-specializer- 
p, which I just use in Closer to MOP. In ecl, I have defined it  
internall, but haven't exported it.

I don't want to implement eql-specializer as a class in Closer to MOP  
because I fear this would lead to unexpected behavior and hard-to- 
find bugs. Imagine someone writes a method like this:

(defmethod foo ((thing eql-specializer)) ...)

Since eql specializers are actually lists in LW and ecl, this method  
wouldn't work. So I prefer my current solution, where defining this  
method already issues an error.

I could indeed provide eql-specializer-p across all CL  
implementations if this helps. That's what you're telling me, if I  
understand correctly, right?


Pascal

> On May 11, 2006, at 4:53 AM, Pascal Costanza wrote:
>
>> I have used the type definition for eql-specializer already in  
>> other CLOS MOP implementations, so Moptilities probably already  
>> has the conditionalization that would only be needed to be  
>> switched on for ecl. (But I am just guessing.) Maybe ask Gary King  
>> about this.
>
>
> -- 
> Gary Warren King
> metabang.com
> http://www.metabang.com/
> (413) 210 7511
> gwking on #lisp (occasionally)
>
>

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium







More information about the closer-devel mailing list