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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Studying and Maintaining GNAT, Is There Any Interest in a New Group? Date: Tue, 28 Aug 2018 09:26:43 +0200 Organization: Aioe.org NNTP Server Message-ID: References: <309225242.556906218.575482.laguest-archeia.com@nntp.aioe.org> <2145221813.556924687.162377.laguest-archeia.com@nntp.aioe.org> <3892c779-2924-405c-b88d-19389fc5ba3e@googlegroups.com> <1ceec6d8-c5c4-49b1-9808-a3580bba3f8e@googlegroups.com> NNTP-Posting-Host: MyFhHs417jM9AgzRpXn7yg.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.3 Xref: reader02.eternal-september.org comp.lang.ada:54277 Date: 2018-08-28T09:26:43+02:00 List-Id: On 2018-08-27 23:27, Randy Brukardt wrote: > "Lucretia" wrote in message > news:1ceec6d8-c5c4-49b1-9808-a3580bba3f8e@googlegroups.com... > ... >> I never said anything about not learning from DIANA, I said don't >> implement it. Reason is simple, it was designed using Ada83, we have >> OO now and OO fits a compiler perfectly and would be a hell of a lot >> nicer than a bunch of variant records/enums. > > Fitting OO into a compiler design could very easily turn into a nightmare of > required overriding routines, making it very painful to add new kinds of > nodes. Which is not even possible with variant records. Enumeration types are not extensible and have no classes anyway to allow building a *comparable* case. E.g. type Choice is (A, B); type Var (Mode : Choice) is record case Mode is when A => ... when B => ... end case; end record; 1. How do you extend Choice: type Choice_Ext is new Choice with (C, D, E); -- This not Ada 2. How do you declare Var to accept any descendant of Choice as a discriminant? type Var (Mode : Choice'Class) is record -- This not Ada 3. How do you extend the variant record Var contains? type Var_Plus (Mode : Choice_Ext) is new Var with ? -- This not Ada Since nothing of that kind is possible, what you propose is monolithic design AKA "god-class", when the variant record must know *in advance* all future "extensions", which are extensions no more. You will need to change the declarations of Choice and Var each time and then revisit all client code they appear. And if the above were possible, how would it be different from inheritance as we know it? -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de