comp.lang.ada
 help / color / mirror / Atom feed
From: "Peter C. Chapin" <pchapin@sover.net>
Subject: Re: Question about circular elaboration order error (GNAT).
Date: Sun, 13 Apr 2008 18:49:25 -0400
Date: 2008-04-13T18:49:25-04:00	[thread overview]
Message-ID: <48028df4$0$19860$4d3efbfe@news.sover.net> (raw)
In-Reply-To: <wccve2l4jxm.fsf@shell01.TheWorld.com>

Robert A Duff wrote:

> The stricter rules are conservative, and modular -- when compiling
> Parent, it sees that you're calling Parent.Child, and assumes the worst
> WITHOUT looking at Parent.Child body.  For example, it assumes that
> Parent.Child might call Dummy, causing a real cycle.

Thanks to you and Samuel Tardieu for your replies. They do help to 
clarify things for me somewhat. It is easy for me to understand how 
Parent.Child's body would have an elaboration dependency on Parent's 
spec, but I did not expect Parent.Child's body to necessarily have an 
elaboration dependency on Parent's body. Are you saying that it doesn't 
(necessarily) have such a dependency in standard Ada, but that I'm 
experiencing an example of GNAT's stricter rules?

In any event I got my example to work with an appropriate application of 
pragma Elaborate. I guess I didn't stumble into the right combination in 
my earlier tinkering. It helps to have a better idea of what is 
happening. :-)

> I suggest you read the section in the GNAT docs about elaboration.
> It explains all this stuff in great detail.

Yes, actually I read that stuff, but I didn't see anything in particular 
about elaboration dependencies between parent and child packages.

>> Note my actual program involves a task in the parent that is trying to
>> use subprograms in the child. However, the difficulties I'm having
>> appear to be unrelated to tasking.
> 
> Don't be too sure.  Tasks get activated "early", and can easily cause
> elab cycles.  Look at the docs for details.

I'm not saying that the errors in the tasking example (my real program) 
are wrong. Indeed, I assumed there was some non-trivial stuff going on 
during elaboration that was stimulating the error. I was just glad when 
I could (apparently) reproduce the problem with a simpler example. That 
makes it easier to study, of course.

Peter



  reply	other threads:[~2008-04-13 22:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-13 18:12 Question about circular elaboration order error (GNAT) Peter C. Chapin
2008-04-13 19:43 ` Samuel Tardieu
2008-04-13 20:20   ` Robert A Duff
2008-04-13 21:20     ` Samuel Tardieu
2008-04-14 20:21       ` Robert A Duff
2008-04-14 23:36         ` Adam Beneschan
2008-04-15  7:13           ` Georg Bauhaus
2008-04-13 19:46 ` Robert A Duff
2008-04-13 22:49   ` Peter C. Chapin [this message]
2008-04-14 13:56     ` Robert A Duff
2008-04-14 17:33 ` Jeffrey R. Carter
2008-04-14 17:52   ` 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