Xref: utzoo comp.object:653 comp.lang.c++:5994 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!xanadu!michael From: michael@xanadu.com (Michael McClary) Newsgroups: comp.object,comp.lang.c++ Subject: Re: Dumb question Message-ID: <1990Jan2.112028.19312@xanadu.com> Date: 2 Jan 90 11:20:28 GMT References: <61737@aerospace.AERO.ORG> <2122@tukki.jyu.fi> Reply-To: michael@xanadu.UUCP (Michael McClary) Organization: Xanadu Operating Company, Palo Alto, CA Lines: 25 In article <2122@tukki.jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) writes: > >Note 2: An old favourite idea of mine is that classes should offer, >as a primitive operation, rather one comparison operator (values: >equal, less, greater, incomparable, equivalent; possibly others >in special cases) than several relational operators. The latter >can be derived from the former, and class interfaces would be simpler. I recommend against this approach. Such an operator must fully characterize the relationship between two objects to answer any question about that relationship. Then the bulk of this work is discarded. This may seem a trivial efficiency quibble, but consider: There are data types where some relations can be determined in microseconds from information in RAM, while others require hours of disk activity (or a tape mount in your Sri Lanka branch office, which is closed due to civil unrest...) When you finally encounter such a data type, will you - accept the ten-orders-of-magnitude performance penalty, - redesign all your code, or - install a special-purpose kludge, thus dropping all your existing tools on the floor?