From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-11 22:02:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!wn14feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail Message-ID: <3F615341.4000100@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.34.139.183 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc01 1063342925 24.34.139.183 (Fri, 12 Sep 2003 05:02:05 GMT) NNTP-Posting-Date: Fri, 12 Sep 2003 05:02:05 GMT Organization: Comcast Online Date: Fri, 12 Sep 2003 05:02:05 GMT Xref: archiver1.google.com comp.lang.ada:42401 Date: 2003-09-12T05:02:05+00:00 List-Id: tmoran@acm.org wrote: > "work in general" can mean, and I think was intended to mean, "work in > all cases", and clearly a single counterexample disproves that. "work in > general" could also take a less formal meaning of "work most of the time", > and I suspect that's the way Hyman took it. In that interpretation of > course, the statement is not disproved by a single counterexample. And in the Ada community there are very few people who distinguish between doesn't work in all cases, and doesn't work. That doesn't apply in this case though. There is no way to directly inherit from two classes, unless one is a subclass of the other. (And of course, that case is not considered multiple inheritance.) Interfaces do not include state, and mix-ins add state, so you can combine any number of mix-ins or interfaces, or combine them and even add one direct parent. Back to my example, just to take this out of the abstract realm. If I inherit from one set of operations where the first state variable is interpreted as distance in the X dimension, and another set of operations where the first state variable represents the length of the vector, you get garbage. This is not unique to this example. It happens every time you have two different definitions of state. If you want to directly inherit the polar class, and also inherit the cartesian interface, that works. Well, sort of. You can't allow the X and Y state variables to be set separately. (Well, maybe you could. Convert the current value to cartesian, change one of the components and convert back. But I'd much rather choose an interface that only allows X and Y to be changed together.) If you want to directly inherit from a cartesian class and add a polar interface, that works too. Or you can combine a cartesian class with a polar mix-in. (But you had better do a lot of overriding to maintain consistancy.) Or you can inherit from two interfaces, or add two mix-ins to a stateless (null) class, with the same caveat about consistancy. -- Robert I. Eachus "As far as I'm concerned, war always means failure." -- Jacques Chirac, President of France "As far as France is concerned, you're right." -- Rush Limbaugh