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,16bd8131a17b875d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!217.73.144.45.MISMATCH!ecngs!feeder2.ecngs.de!newsfeed.freenet.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Virtual Components in Ada and Ruby Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.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: <2ifue.819$Z97.597@trndny06> <9oadnZwlOoYa7V7fRVn-2A@megapath.net> Date: Thu, 30 Jun 2005 09:53:02 +0200 Message-ID: <1dvcq9fimqv12.g8zq212sn8fw$.dlg@40tude.net> NNTP-Posting-Date: 30 Jun 2005 09:53:02 MEST NNTP-Posting-Host: 65350b6c.newsread4.arcor-online.net X-Trace: DXC=DlJM;PeBC_VD__2dTlB=E[:ejgIfPPldTjW\KbG]kaMX]kI_X=5KeaV^moH62iaKR^WRXZ37ga[7Zn919Q4_`VjYB8=X\UUgbkT X-Complaints-To: abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:11752 Date: 2005-06-30T09:53:02+02:00 List-Id: On Wed, 29 Jun 2005 23:12:48 -0500, Randy Brukardt wrote: > "Frank J. Lhota" wrote in message > news:2ifue.819$Z97.597@trndny06... > .... >> Looking ahead to Ada 201Z, should there be user-defined virtual record >> components? Currently, a component of a record must always be defined as >> a section of memory in a record. Would it be desirable to also be able >> to define a record component in terms of subprograms for reading and >> writing that component? Yes! Though this is not the complete list of what "record interface" should do. Also: 1. Record aggregates should be support "virtual" user-defined components. 2. The most important thing is "virtual" discriminants. This would open a great variety of possibilities. 3. Overriding non-"virtual" components with "virtual" ones and vice versa. 4. Abstract "virtual" components to be required for overriding and thus abstract record types. > I think it would likely be too ambiguous with other possibilities to be very > useful. I think that "record interface" could drastically improve Ada. Virtual members is only a part of what should be: an ability to provide private implementation of a record type (and also an array or an access type.) > Certainly, Ada 200Y has "virtual record components" for reading: > > type Something is tagged record ... end record; > function Virtual (Obj : in Somthing) return Integer; > > Object : Something; > > if Object.Virtual = 10 then ... > > But there doesn't seem to be a practical way to make them writable on the > LHS of an assignment. A procedure call isn't too bad in that case: > Object.Set_Virtual (To => ); Though it is unsuitable if you want, for example, pass a virtual record type as a generic parameter. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de