[cdr-discuss] AEQUALIS and COMPARE

Marco Antoniotti marcoxa at cs.nyu.edu
Tue Feb 15 14:21:03 UTC 2011


On Feb 15, 2011, at 14:36 , Attila Lendvai wrote:

>> - The idea that COMPARE returns symbols also seems weird to me. Wouldn't it be better to return numbers (-1, 0, +1 or NIL)? Can't immediately tell why, though.
> 
> 
> you need to return well-known identities that communicate the result.
> -1,0,+1 are the easy way for well-known identities in C. in CL,
> symbols provide a much nicer framework to deal with well-known
> identities IMO.

That was the thinking.

>> - Shouldn't there also be a hash-code generic function that can be specialized alongside AEQUALIS? This also exists in Java and C#, and could make this immediately more useful (and would be much harder to add later as an afterthought). Many CL implementation add an :sxhash option to make-hash-table, where such a hash-code function could be used.
> 
> 
> a big +1 for the above.


You should but:

As in Java (and FWIU in C#) there are no "easy" ways (for an appropriate definition of "easy") to enforce the protocol.
What would be the default?  Something like

		(defmethod hash-code ((x t)) (sxhash x))


If you think so, I can add it to the doc.  Always with the caveat that there is no way to enforce the relationship between equality and hashing.

Marco

PS.  Yeah.  AEQUALIS is very Latin :)  Any synonym?  I will just vote against EGAL, which I really don't like :)








> 
> -- 
>  attila
> 
> Notice your eroding (digital) freedom, and do something about it!
> 
> PGP: 2FA1 A9DC 9C1E BA25 A59C  963F 5D5F 45C7 DFCD 0A39
> OTR XMPP: 8647EEAC EA30FEEF E1B55146 573E52EE 21B1FF06
> BitCoin: 154uf86Vd9rpjMULd9CXa7nVwikknYZJiB
> 
> 

--
Marco Antoniotti


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cdr-discuss/attachments/20110215/c928bb41/attachment.html>


More information about the cdr-discuss mailing list