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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab66185f2bca0483 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-18 12:40:49 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!feedme.news.mediaways.net!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Extension of non-limited type needs limited component Date: Mon, 18 Nov 2002 14:33:03 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <2dbd76f3.0211130203.7d2d14fd@posting.google.com> <2dbd76f3.0211140126.5d233e41@posting.google.com> <3vb7tug4h99mmalcn0l5ul18cu0ui6i458@4ax.com> <6bd9tuc40p68a86rlur3hai1qlv54i8985@4ax.com> X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:31067 Date: 2002-11-18T14:33:03-06:00 List-Id: Dale Stanbrough wrote in message ... >In article , > Robert A Duff wrote: > >> By the way, have you read the AARM annotations that explain why we >> didn't allow user-defined ":=" procedures? We certainly wanted to, >> but we couldn't figure out how to make it work, so we invented Adjust, >> which is not as powerful. I'd be interested in hearing better ideas >> (even though it's probably too late). > >It seemed to me that the main problem with with discriminants >in the tagged types. Would it not have been simpler just to >disallow them? Would this have allowed you to have a ":=" >procedure? No, the main problem is components of controlled types used in untagged variant records. We hardly could disallow discriminants on all records! We can't disallow components of controlled types that are discriminant-dependent, because that would be a generic contract violation. (Tagged types match generic formal private types.) Assume-the-worst here would be very incompatible. So, to get a first-class ":=", you'd have to make seriously incompatible changes to Ada 83. (Not to mention Ada 95.) That just doesn't work. To show the problem in short, assume that 'Window' is a controlled type with a user-defined ":=". type Prob (B : Boolean := True) is record case B is when True => W : Window; when False => null; end case; end record; Obj_False : Prob (False); Obj_True : Prob (True); Obj : Prob; Obj := Obj_False; -- Component W disappears in this assignment. (It is Finalized only.) Obj := Obj_True; -- Component W appears in this assignment. (It is Adjusted only.) So, what are the parameters to a user-defined ":="?? The problem is even more fun when it happens in a discriminant-dependent array. One of the nice things (from an implementability perspective) about the Adjust solution is that it composes nicely. User-defined ":=" does not seem to have this property unless disappearing components are somehow disallowed. Randy Brukardt.