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: a07f3367d7,85d5a13738392342 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!y13g2000prb.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Unknown discriminants with nested records Date: Mon, 20 Jun 2011 09:16:57 -0700 (PDT) Organization: http://groups.google.com Message-ID: <9b0c48f3-c4d7-44dc-8a79-bb38b7803366@y13g2000prb.googlegroups.com> References: <1e197c14-a2ff-4867-85be-fda06a10e37b@a7g2000vby.googlegroups.com> <2191e8b5-e827-41e8-b8a0-f02b8a68362c@v10g2000yqn.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1308586618 2323 127.0.0.1 (20 Jun 2011 16:16:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 20 Jun 2011 16:16:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: y13g2000prb.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19963 Date: 2011-06-20T09:16:57-07:00 List-Id: On Jun 18, 1:33=A0am, Yannick Duch=EAne (Hibou57) wrote: > Le Fri, 17 Jun 2011 16:50:52 +0200, Robert A Duff =A0 > a =E9crit:> Jeff Carter is correct about t= he original reason for the (<>) feature > > -- to fix the generic contract model, which was broken in Ada 83. > > This also had the nice side effect to allow to define types forcing =A0 > entities initialization. A side effect that cannot be relied on, as is evident from this thread. As I tried to say earlier, if the language needs a feature to allow the user to define a type for which objects must be initialized, we should add a feature specifically for that purpose. Trying to be clever and pressing some other language feature into double duty seems to come back to bite us most of the time. As Jeff said, the problem in Ada 83 arose because the actual for a generic formal could be a type for which you weren't supposed to be able to declare an object (including a variable, record component, array element type, etc.). The (<>) feature was added not only to generic formal types but also to private types; I'm not sure whether the feature was added to private types just because it was being added to generic formal types and someone thought it would make sense to add it there too, or whether there were other considerations. Anyway, I'm guessing that the intent was more to *prevent* objects of the type from being declared, much as it was in the generic formal case, although one could still declare objects of an access to that type, and one could still declare parameters of that type. The fact that you could still declare a variable of that type if it had an initial value apparently gave some people a bright idea that the feature could be used to force initialization. But I don't think that was the original intent; and when you use a feature for something for which it wasn't intended, you run the risk that it won't always work for you, which is what the OP found. -- Adam