Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!think.com!spool.mu.edu!uunet!mcsun!ukc!edcastle!aiai!jeff From: jeff@aiai.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: Types in Common Lisp (was Re: In defense of call/cc) Message-ID: <4200@skye.ed.ac.uk> Date: 20 Feb 91 19:03:56 GMT References: <1991Feb12.233157.20820@elroy.jpl.nasa.gov> <1350036@otter.hpl.hp.com> <1991Feb18.031643.10720@cs.cmu.edu> Reply-To: jeff@aiai.UUCP (Jeff Dalton) Organization: AIAI, University of Edinburgh, Scotland Lines: 46 In article kers@hplb.hpl.hp.com (Chris Dollin) writes: > >Steve Knight said: > > > [3] equality doesn't work the way it does in other lisps & is > >a nasty source of problems (e.g. portability) > >and got various responses on the lines "but how would the system know >to do any better?". What I was, and still am, wondering is how it "doesn't work the way it does in other Lisps" and why it's a "nasty source of problems (eg, portability)". Especially since EQL works reasonably for numbers, unlike EQ in most Lisps. (EQ doesn't work "reasonably" for numbers in CL either, but CL has EQL while most other Lisps did not.) You've answered a different question, namely "How is equality handled better in Pop than in Lisp?" (I agree, by the way, that Pop handles equality in a good way and that Common Lisp would be better if it had an extendable equality predicate that could be specialized by type.) >Surely the answer is "it doesn't; but the programmer does, and they >can tell the system what to do"; But the programmer _can_ tell the system what to do, by writing a function and calling it, by writing a generic function and lots of methods, etc. > viz, attatch to datatypes a user-definable >equality procedure with a suitable default (probably structural equality). OK, here's something fairly close: (defgeneric nice-equality (x y) (:method ((r string) (s string)) (string= r s)) ;case-sensitive (:method (x y) (equalp x y))) This is, of course, another case where CL would probably have been a better language if an object system had been included from the start. -- jd