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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c1fe4bc1dd51fc87 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!eweka.nl!lightspeed.eweka.nl!npeer.de.kpn-eurorings.net!npeer-ng1.kpn.DE!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: User-defined type attributes Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <30f629fd-69d3-4d40-995f-9933f52b8dad@s37g2000prg.googlegroups.com> <965suhjl0bxt$.74se2ylyksin.dlg@40tude.net> Date: Sat, 15 Mar 2008 10:33:38 +0100 Message-ID: <13vp773bcnkwf.7zfswly78jlo$.dlg@40tude.net> NNTP-Posting-Date: 15 Mar 2008 10:33:38 CET NNTP-Posting-Host: 4802a03f.newsspool3.arcor-online.net X-Trace: DXC=g52D0`FkCQ^\PS5Xo=M[RVMcF=Q^Z^V3X4Fo<]lROoRQ8kF On Fri, 14 Mar 2008 22:04:53 -0500, Randy Brukardt wrote: > Not if you need other generic parameters along with the type. And this is a > way to do mixins, which otherwise can't be done in Ada 95 because type can't > derive from a class-wide type: > > generic > type S is new T with private; > package Foo is > type New_S is new S with private; > procedure New_Operation (Op : in out New_S); > end Foo; > > It's a nice way to add persistence, for instance. (Interfaces only allow you > to add, umm, interfaces, not code.) Speaking of language enhancements proper multiple inheritance would be a better way to do this. But actually I would like to have "supertypes" in order to be able to add interfaces and code to existing types: type T is ...; -- Defined independently on Persistent type Persistent is abstract...; -- Oops, we forgot to do it before T type Bridge is new Persistent and old T; --- (:-)) Bridge is a subtype of Persistent and a supertype of T. This injects Bridge's implementation of Persistent into T within Bridge's scope. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de