comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Elaboration circularity with generics
Date: Mon, 16 Jan 2012 09:02:13 -0800 (PST)
Date: 2012-01-16T09:02:13-08:00	[thread overview]
Message-ID: <b052aca2-bb9d-41dd-b318-6ec0a0ea7f88@f11g2000yql.googlegroups.com> (raw)
In-Reply-To: 9b4cad32-89fc-44f2-b760-5604d7cb5a5e@o12g2000vbd.googlegroups.com

On Jan 15, 9:43 am, AdaMagica <christ-usch.gr...@t-online.de> wrote:
> On 15 Jan., 18:15, Maciej Sobczak <see.my.homep...@gmail.com> 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



  reply	other threads:[~2012-01-16 17:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-14 15:09 Elaboration circularity with generics Maciej Sobczak
2012-01-14 16:13 ` Martin Dowie
2012-01-14 16:17 ` AdaMagica
2012-01-14 22:46   ` Simon Wright
2012-01-15 16:55     ` AdaMagica
2012-01-16 15:09       ` Simon Wright
2012-01-16 17:15         ` AdaMagica
2012-01-14 16:26 ` AdaMagica
2012-01-14 22:01 ` Georg Bauhaus
2012-01-15 17:15   ` Maciej Sobczak
2012-01-15 17:43     ` AdaMagica
2012-01-16 17:02       ` Adam Beneschan [this message]
2012-01-16 14:34     ` Robert A Duff
2012-01-16 21:29       ` Maciej Sobczak
2012-01-16 21:52         ` Adam Beneschan
2012-01-16 22:25         ` Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox