From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeeds.belnet.be!news.belnet.be!news2.kpn.net!news.kpn.net!nslave.kpnqwest.net!nloc.kpnqwest.net!nmaster.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: MD5 in LISP and abstraction inversions References: <87lmhrznup.fsf@Samaris.tunes.org> <2hadxn7vp2.fsf@dslab7.cs.uit.no> <9t1pbp$njh$1@rznews2.rrze.uni-erlangen.de> Mail-Copies-To: never From: Erik Naggum Message-ID: <3214932822476660@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 71 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 16 Nov 2001 20:53:45 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader1.kpnqwest.net 1005944025 193.71.66.49 (Fri, 16 Nov 2001 21:53:45 MET) NNTP-Posting-Date: Fri, 16 Nov 2001 21:53:45 MET Xref: archiver1.google.com comp.lang.lisp:20151 * Bruce Hoult | 1) no one is forcing you to implement = and < for every class. But what does it mean to implement < for a new class, supposing for the sake of argument it was a generic function? This remains unclear to me. (< a b c d) has a well-defined meaning for all real number types. (It is less clear what it means for complex numbers, for instance.) E.g., even though we most probably test only (< a b), (< b c), and (< c d), a true return value implies that (< a c), (< a d), and (< b d) are also true, and we are free to exploit this knowledge. To make sure this holds for a user-defined type, it may be necessary to make those tests explicit, meaning that < becomes as expensive as /=. (Some may not have realized that (/= a b c d) is not simply (not (= a b c d)).) We also know that (< a b) and (not (< b a)) is true for numbers, but because of generic function dispatch, (< a b) and (< b a) may be implemented by different methods, and it may no longer hold. Even if we have an implementation of < that dispatches only on its first argument, this would be true. It would also mean that (and (< a b) (< b c)) may yield a different result than (< a c) if only because of which method is called. The probability of creating a royal mess here is staggeringly high, as any C++ programmer who has tried to overload < will know, but no C++ programmer will ever bother to see if a