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,FREEMAIL_FROM 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-16 10:29:41 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: hyrosen@mail.com (Hyman Rosen) Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: 16 Sep 2003 10:29:37 -0700 Organization: http://groups.google.com/ Message-ID: <568ede3c.0309160929.1d0d3d95@posting.google.com> References: NNTP-Posting-Host: 204.253.248.214 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1063733381 19496 127.0.0.1 (16 Sep 2003 17:29:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Sep 2003 17:29:41 GMT Xref: archiver1.google.com comp.lang.ada:42580 Date: 2003-09-16T17:29:41+00:00 List-Id: Matthew Heaney wrote in message news:... > Ada95 doesn't have MI. It will never have MI. So what to do? Sure, you do what the language allows to express what you need to do. And Ada is getting interfaces, after all. Maybe one day it will have full MI. > I happen to think that access disciminants are quite elegant. They are > quite general and powerful. Hardly "gimmicky" at all. Not access discriminants themselves, just the way to get them initialized with the address of the object they're contained in. Java does the same thing with nested classes, so it's probably just me; I'm used to C++, where doing the same thing would require an explicit pointer member and a constructor to initialize it. Anyway, one of the things that this approach misses from true MI is the ability to cross-cast between pointer types without knowing the name of a common containing class. In my Colorable/Resizable example, I could take a 'Colorable *' and do a dynamic_cast to 'Resizable *' on it. If the Colorable pointer was actually pointing to a base Colorable class of a class that also contained a base Resizable class, the cast would succeed and give me a pointer to that Resizable class. In the access discriminant case, the best I can do is to get the containing object and then get its Resizable part, but that requires knowing about the type of the containing object. This sort of thing can be useful if you are trying to query an object to see if it supports a particular interface, for example.