[pro] "fhash"

Zach Beane xach at xach.com
Tue Jun 14 17:48:27 UTC 2011


Raymond Wiker <rwiker at gmail.com> writes:

> On Jun 14, 2011, at 19:30 , Martin Simmons wrote:
>
>>>>>>> On Tue, 14 Jun 2011 09:32:50 -0400, Daniel Weinreb said:
>>> 
>>> But Fare pointed out to me that being able to add generic functions
>>> specialized on these would be a good thing.  This would mean making them use
>>> CLOS not for encapsulation but for genericty.
>> 
>> Use can specialize methods on defstruct classes too, so they don't have to be
>> CLOS instances defined with defclass.
>
> Built-in classes too[1], which means that you can have methods
> specialized on (e.g.) single-float and double-float, fixnum and
> bignum, list and vector, etc.

Well, only if those types also happen to have a corresponding
implementation-specific class. SINGLE-FLOAT, DOUBLE-FLOAT, FIXNUM, and
BIGNUM are specified as types. LIST and VECTOR are system classes. FLOAT
is also a system class.

I recently ran into some accidentally unportable code that specialized a
method argument on DOUBLE-FLOAT. It worked in SBCL but failed in CLISP
because CLISP provides no DOUBLE-FLOAT class.

Zach




More information about the pro mailing list