comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: parent package referring to child
Date: Wed, 10 Oct 2007 13:20:07 -0700
Date: 2007-10-10T13:20:07-07:00	[thread overview]
Message-ID: <1192047607.865747.220890@50g2000hsm.googlegroups.com> (raw)
In-Reply-To: <1192044748.953712.248880@v3g2000hsg.googlegroups.com>

On Oct 10, 12:32 pm, Matthew Heaney <mhea...@on2.com> wrote:
> On Oct 10, 2:54 pm, Vadim Godunko <vgodu...@gmail.com> wrote:
>
>
>
> > > You can do this in Ada05:
>
> > > limited with P.C;
> > > package P is
> > >    procedure Op (O : in out P.C.T);
>
> >                    O : access P.C.T
> > You can't use "in out" mode, T have only limited view at this point.
>
> No, that's wrong.  In this case you can use mode inout because type T
> is tagged (meaning that it's passed by reference).

I don't see what the parameter mode has to do with it.  I can't find a
rule that would make "procedure Op (O : in P.C.T);" illegal.  Also,
GNAT accepts it in a small test case I just tried, although that
doesn't necessarily mean much (see below).  Then again, on second
reading, maybe I read too much into what you said.

Also, the "by reference" comment isn't relevant either.  If the
package that you're LIMITED WITH'ing contains an untagged type, you
can't use it as a parameter of any mode except "access", regardless of
whether it's a by-reference type.  The relevant rules are 3.10.1(5-9),
which spell out what an "incomplete view" of a type can be used for
(including a type declared in a LIMITED WITH'ed package); the rules
are different for tagged and untagged types (or, technically, tagged
and untagged incomplete views of types).


> Try it!

That doesn't seem to be particularly good advice.  You can "try it"
only by running it through a compiler, but that still won't tell you
whether the code is illegal because many compilers accept a lot of
code that they shouldn't.  I know GNAT has accepted plenty of illegal
code in the past.  (Some of the bugs have been fixed in later
versions.)

                      -- Adam





  reply	other threads:[~2007-10-10 20:20 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-10  6:23 parent package referring to child eliben
2007-10-10  9:07 ` Georg Bauhaus
2007-10-10  9:24   ` eliben
2007-10-10 14:46     ` Adam Beneschan
2007-10-10 19:26   ` Simon Wright
2007-10-10 14:59 ` Matthew Heaney
2007-10-10 18:54   ` Vadim Godunko
2007-10-10 19:32     ` Matthew Heaney
2007-10-10 20:20       ` Adam Beneschan [this message]
2007-10-11  4:12         ` Randy Brukardt
2007-10-11 15:21           ` Adam Beneschan
2007-10-19 12:45           ` Vadim Godunko
2007-10-10 19:51   ` Matthew Heaney
2007-10-10 17:06 ` Jeffrey R. Carter
2007-10-10 19:17 ` anon
2007-10-11  9:45 ` george
2007-10-12  4:15   ` Jeffrey R. Carter
2007-10-12  9:51     ` Georg Bauhaus
replies disabled

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