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,5f9c25380ec58962 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.75.170 with SMTP id d10mr8047718pbw.6.1326733333724; Mon, 16 Jan 2012 09:02:13 -0800 (PST) Path: lh20ni189232pbb.0!nntp.google.com!news2.google.com!postnews.google.com!f11g2000yql.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Elaboration circularity with generics Date: Mon, 16 Jan 2012 09:02:13 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <583b1bfe-95bd-4669-b16b-c733c81e8f88@w4g2000vbc.googlegroups.com> <1007811599348271064.048391rm-host.bauhaus-maps.arcor.de@news.arcor.de> <9e273746-1663-4fef-9154-f37a25d3c01b@o13g2000vbf.googlegroups.com> <9b4cad32-89fc-44f2-b760-5604d7cb5a5e@o12g2000vbd.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1326733333 23121 127.0.0.1 (16 Jan 2012 17:02:13 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 16 Jan 2012 17:02:13 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f11g2000yql.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) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-01-16T09:02:13-08:00 List-Id: On Jan 15, 9:43=A0am, AdaMagica wrote: > On 15 Jan., 18:15, Maciej Sobczak wrote: > > > In such a case I would consider it to be a compiler bug. > > No, this isn't a bug. The elaboration order is not completely defined. > If the compiler cannot find a valid order, it may reject the program. > The programmer then has to help the compiler with pragmas. I think some clarification may help. There's a rule in 10.2(18) that says "there shall be a total order of the library_items that obeys the above rules". This rule is simple enough that any compiler should be able to follow it; so if there is a total order and a compiler cannot find it, the compiler definitely has a bug. However, the compiler is *not* required to try to find an elaboration order that will guarantee that Program_Error is not raised at runtime. Technically, a program that follows the language rules but is certain to fail as soon as it's run should not be rejected by the compiler, since it's a legal Ada program. But it's useful for compilers to report errors in such cases. This may make it "non- standard" in some sense, but I wouldn't consider it a bug if the behavior is documented and an option is provided to follow the standard technically. -- Adam