Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!otter.hpl.hp.com!hpltoad!cdollin!kers From: kers@hplb.hpl.hp.com (Chris Dollin) Newsgroups: comp.lang.lisp Subject: Re: Types in Common Lisp (was Re: In defense of call/cc) Message-ID: Date: 19 Feb 91 15:32:05 GMT References: <1991Feb12.233157.20820@elroy.jpl.nasa.gov> <1350036@otter.hpl.hp.com> <1991Feb18.031643.10720@cs.cmu.edu> Sender: news@hplb.hpl.hp.com (Usenet News Administrator) Organization: Hewlett-Packard Laboratories, Bristol, UK. Lines: 25 In-Reply-To: ram+@cs.cmu.edu's message of 18 Feb 91 03:16:43 GMT Nntp-Posting-Host: cdollin.hpl.hp.com 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?". Surely the answer is "it doesn't; but the programmer does, and they can tell the system what to do"; viz, attatch to datatypes a user-definable equality procedure with a suitable default (probably structural equality). Thus a defstruct would have a equality-predicate option (eqp?) and all the system types would come equipped with standard-defined eqp's (which might be indirected through symbols, so they could be changed if one felt reckless). The standard function eqp could then just dispatch through a type-indexed table. The only question that comes to mind is whether the indexing should be on one argument or two, and if on one, whether we assume that two objects of different data-type can ever be equal - sorry eqp - eg is (eqp 1.0 1) true or not? -- Regards, Kers. | "You're better off not dreaming of the things to come; Caravan: | Dreams are always ending far too soon."