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-Thread: 103376,c022fc5445abd13d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 28 Nov 2005 20:45:26 -0600 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1131062882.814405.147150@g44g2000cwa.googlegroups.com> Subject: Re: Discriminated types with default discriminants Date: Mon, 28 Nov 2005 20:49:32 -0600 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-hlK0fw4qUiwnZgeZoSOTy5E7LvAQnwu/SafUrmZ6+5wVZy0GYjEe62/7ln80W1eYrUvzSsX28OulBBL!zE45BlHySB3hpSRxg/hKUqh7bPPo1kKtXRm90EnHF6Z9ssAjjXQQNh/bK3o9MFIry1UCVB2DY27K X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:6658 Date: 2005-11-28T20:49:32-06:00 List-Id: "Adam Beneschan" wrote in message news:1131062882.814405.147150@g44g2000cwa.googlegroups.com... > Robert A Duff wrote: > > > > A few compilers will add a level of indirection, and store the > > > variable-sized stuff elsewhere, reallocating storage when the amount > > > available is not big enough. > > > > It is quite difficult to get the indirect approach to work right. > > Think about renaming a subcomponent of the thing, > > Ummm ... isn't this exactly what's disallowed by 8.5.1(5)? Yes, it is. Bob is thinking about cases where a non-discriminant component is moved by the changing of a discriminant. (I know this because he and I have had this particular discussion repeatedly.) An implementation like that is bound to fail, IMHO. On the other hand, an implementation like Janus/Ada's (in which discriminant dependent components are just descriptors to the actual data) doesn't have this problem. (There is some complication determining the correct storage pool to use - think about a discriminant changing assignment on a subprogram parameter - but its not particularly hard to get right.) Randy.