comp.lang.ada
 help / color / mirror / Atom feed
* with child: access to parent
@ 2001-10-02 10:06 Peter Hermann
  2001-10-02 10:49 ` Pat Rogers
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Hermann @ 2001-10-02 10:06 UTC (permalink / raw)


We happened to detect following non-expected 
language permission (at least by gnat3.13p):

--------------------
with pak.child;
procedure mytest is
begin
   pak.hugo:=1;
   end;
--------------------
package pak is
   hugo :integer;
   end pak;
--------------------
package pak.child is
end;
--------------------

This may be perfectly legal but
I can not find the appropriate rule 
in the LRM.

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 10:06 with child: access to parent Peter Hermann
@ 2001-10-02 10:49 ` Pat Rogers
  2001-10-02 12:53   ` Marc A. Criley
  2001-10-02 14:10   ` Peter Hermann
  0 siblings, 2 replies; 15+ messages in thread
From: Pat Rogers @ 2001-10-02 10:49 UTC (permalink / raw)



"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:9pc3jp$old$1@infosun2.rus.uni-stuttgart.de...
> We happened to detect following non-expected
> language permission (at least by gnat3.13p):
>
> --------------------
> with pak.child;
> procedure mytest is
> begin
>    pak.hugo:=1;
>    end;
> --------------------
> package pak is
>    hugo :integer;
>    end pak;
> --------------------
> package pak.child is
> end;
> --------------------
>
> This may be perfectly legal but
> I can not find the appropriate rule
> in the LRM.



10.1.2 Context Clauses - With Clauses

6     A library_item is mentioned in a with_clause if it is denoted by a
library_unit_name or a prefix in the with_clause.



---
Patrick Rogers                       Consulting and Training in:
http://www.classwide.com          Real-Time/OO Languages
progers@classwide.com               Hard Deadline Schedulability Analysis
(281)648-3165                                 Software Fault Tolerance





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 10:49 ` Pat Rogers
@ 2001-10-02 12:53   ` Marc A. Criley
  2001-10-02 14:25     ` Peter Hermann
  2001-10-02 14:10   ` Peter Hermann
  1 sibling, 1 reply; 15+ messages in thread
From: Marc A. Criley @ 2001-10-02 12:53 UTC (permalink / raw)


Pat Rogers wrote:
> 
> "Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
> news:9pc3jp$old$1@infosun2.rus.uni-stuttgart.de...
> > We happened to detect following non-expected
> > language permission (at least by gnat3.13p):
> >
> > --------------------
> > with pak.child;
> > procedure mytest is
> > begin
> >    pak.hugo:=1;
> >    end;
> > --------------------
> > package pak is
> >    hugo :integer;
> >    end pak;
> > --------------------
> > package pak.child is
> > end;
> > --------------------
> >
> > This may be perfectly legal but
> > I can not find the appropriate rule
> > in the LRM.
> 
> 10.1.2 Context Clauses - With Clauses
> 
> 6     A library_item is mentioned in a with_clause if it is denoted by a
> library_unit_name or a prefix in the with_clause.

Which means that

with pak.child;

is equivalent to:

with pak;
with pak.child;


Marc A. Criley
Senior Staff Engineer
Quadrus Corporation
www.quadruscorp.com



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 10:49 ` Pat Rogers
  2001-10-02 12:53   ` Marc A. Criley
@ 2001-10-02 14:10   ` Peter Hermann
  2001-10-02 14:17     ` Ted Dennison
                       ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Peter Hermann @ 2001-10-02 14:10 UTC (permalink / raw)


Pat Rogers <progers@classwide.com> wrote:
> 10.1.2 Context Clauses - With Clauses
> 6     A library_item is mentioned in a with_clause if it is denoted by a
> library_unit_name or a prefix in the with_clause.

does this mean, that

with a.b.c.d;

is equivalent to

with a;
with a.b;
with a.b.c;
with a.b.c.d;

?

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:10   ` Peter Hermann
@ 2001-10-02 14:17     ` Ted Dennison
  2001-10-02 15:17       ` Wes Groleau
  2001-10-02 14:22     ` Pat Rogers
  2001-10-03  0:34     ` dale
  2 siblings, 1 reply; 15+ messages in thread
From: Ted Dennison @ 2001-10-02 14:17 UTC (permalink / raw)


In article <9pchrq$8vt$1@infosun2.rus.uni-stuttgart.de>, Peter Hermann says...
>with a.b.c.d;
>
>is equivalent to
>
>with a;
>with a.b;
>with a.b.c;
>with a.b.c.d;

I'm not sure if that's what the LRM passage is saying, but this is the case. Try
it out yourself. Essentially, all those "with"s but the last one are redundant.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com
No trees were killed in the sending of this message. 
However a large number of electrons were terribly inconvenienced.



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:10   ` Peter Hermann
  2001-10-02 14:17     ` Ted Dennison
@ 2001-10-02 14:22     ` Pat Rogers
  2001-10-08 10:51       ` Jean-Pierre Rosen
  2001-10-03  0:34     ` dale
  2 siblings, 1 reply; 15+ messages in thread
From: Pat Rogers @ 2001-10-02 14:22 UTC (permalink / raw)


"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:9pchrq$8vt$1@infosun2.rus.uni-stuttgart.de...
> Pat Rogers <progers@classwide.com> wrote:
> > 10.1.2 Context Clauses - With Clauses
> > 6     A library_item is mentioned in a with_clause if it is denoted by a
> > library_unit_name or a prefix in the with_clause.
>
> does this mean, that
>
> with a.b.c.d;
>
> is equivalent to
>
> with a;
> with a.b;
> with a.b.c;
> with a.b.c.d;

Yes, exactly right.





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 12:53   ` Marc A. Criley
@ 2001-10-02 14:25     ` Peter Hermann
  2001-10-02 14:44       ` Pat Rogers
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Hermann @ 2001-10-02 14:25 UTC (permalink / raw)


Marc A. Criley <mcqada@earthlink.net> wrote:
> Which means that

> with pak.child;

> is equivalent to:

> with pak;
> with pak.child;

thank you.
10.1.2(6) does not clearly state this fact.

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:25     ` Peter Hermann
@ 2001-10-02 14:44       ` Pat Rogers
  0 siblings, 0 replies; 15+ messages in thread
From: Pat Rogers @ 2001-10-02 14:44 UTC (permalink / raw)



"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:9pcip8$8vt$2@infosun2.rus.uni-stuttgart.de...
> Marc A. Criley <mcqada@earthlink.net> wrote:
> > Which means that
>
> > with pak.child;
>
> > is equivalent to:
>
> > with pak;
> > with pak.child;
>
> thank you.
> 10.1.2(6) does not clearly state this fact.

You asked for the rule, not the exegesis!  :-) :-)





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:17     ` Ted Dennison
@ 2001-10-02 15:17       ` Wes Groleau
  2001-10-02 16:14         ` Peter Hermann
  2001-10-12 13:58         ` Simon Wright
  0 siblings, 2 replies; 15+ messages in thread
From: Wes Groleau @ 2001-10-02 15:17 UTC (permalink / raw)




Ted Dennison wrote:
> it out yourself. Essentially, all those "with"s but the last one are redundant.

Some style guides suggest _always_ listing the parent specifically
if anything in it is referenced.  I guess the idea is to prevent
compile errors if the child references are removed.  But how many
places actually take the trouble of removing unused withs?  And
what is the more expensive way to find the need to add one--to
carefully eyeball the code, or to compile and look at the messages?

-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 15:17       ` Wes Groleau
@ 2001-10-02 16:14         ` Peter Hermann
  2001-10-12 13:58         ` Simon Wright
  1 sibling, 0 replies; 15+ messages in thread
From: Peter Hermann @ 2001-10-02 16:14 UTC (permalink / raw)


Wes Groleau <wwgrol@sparc01.ftw.rsc.raytheon.com> wrote:
> Some style guides suggest _always_ listing the parent specifically
> if anything in it is referenced.  I guess the idea is to prevent
> compile errors if the child references are removed.  But how many
> places actually take the trouble of removing unused withs?  And
> what is the more expensive way to find the need to add one--to
> carefully eyeball the code, or to compile and look at the messages?

Of course it is a welcome convenience to save a couple of "with"s.
An advanced binder/linker will automagically leave out heavy-weight
unused parts of executable code, anyway.
For readable programs I am considering a largely use-less style
more favorable than the above (style-) rule.

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:10   ` Peter Hermann
  2001-10-02 14:17     ` Ted Dennison
  2001-10-02 14:22     ` Pat Rogers
@ 2001-10-03  0:34     ` dale
  2 siblings, 0 replies; 15+ messages in thread
From: dale @ 2001-10-03  0:34 UTC (permalink / raw)


Peter Hermann wrote:

> does this mean, that
> 
> with a.b.c.d;
> 
> is equivalent to
> 
> with a;
> with a.b;
> with a.b.c;
> with a.b.c.d;

Probably worth mentioning that the semantics for "use" are
not the same.
e.g. 

   use a.b.c.d; 

is not equivalent to...

   use a;
   use a.b;
   use a.b.c;
   use a.b.c.d;


Dale



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 14:22     ` Pat Rogers
@ 2001-10-08 10:51       ` Jean-Pierre Rosen
  2001-10-11 15:07         ` Peter Hermann
  0 siblings, 1 reply; 15+ messages in thread
From: Jean-Pierre Rosen @ 2001-10-08 10:51 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]


"Pat Rogers" <progers@classwide.com> a �crit dans le message news: X4ku7.7990$Eq3.3697458203@newssvr11.news.prodigy.com...
> > does this mean, that
> >
> > with a.b.c.d;
> >
> > is equivalent to
> >
> > with a;
> > with a.b;
> > with a.b.c;
> > with a.b.c.d;
>
> Yes, exactly right.
>
Note however that if you really want the child and not the parents, you can do the following:

with a.b.c.d;
package a_b_c_d renames a.b.c.d;

with a_b_c_d;
...

--
---------------------------------------------------------
           J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-11 15:07         ` Peter Hermann
@ 2001-10-11 14:54           ` Pat Rogers
  0 siblings, 0 replies; 15+ messages in thread
From: Pat Rogers @ 2001-10-11 14:54 UTC (permalink / raw)


"Peter Hermann" <ica2ph@iris16.csv.ica.uni-stuttgart.de> wrote in message
news:9q4cjm$jnf$1@infosun2.rus.uni-stuttgart.de...
> Jean-Pierre Rosen <rosen@adalog.fr> wrote:
> > Note however that if you really want the child and not the parents,
> > you can do the following:
>
> > with a.b.c.d;
> > package a_b_c_d renames a.b.c.d;
>
> > with a_b_c_d;
> > ...
>
> does that mean package a_b_c_d is a unit on library level
> in its own right?

Yes, it is a library unit renaming, as is the case, for example, with
Text_IO (which renames Ada.Text_IO) by 10.1.1{4}:

library_item ::= [private] library_unit_declaration
  | library_unit_body
  | [private] library_unit_renaming_declaration


> If yes, how to map into the gnat file naming system?

a_b_c_d.ads





^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-08 10:51       ` Jean-Pierre Rosen
@ 2001-10-11 15:07         ` Peter Hermann
  2001-10-11 14:54           ` Pat Rogers
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Hermann @ 2001-10-11 15:07 UTC (permalink / raw)


Jean-Pierre Rosen <rosen@adalog.fr> wrote:
> Note however that if you really want the child and not the parents,
> you can do the following:

> with a.b.c.d;
> package a_b_c_d renames a.b.c.d;

> with a_b_c_d;
> ...

does that mean package a_b_c_d is a unit on library level 
in its own right?
If yes, how to map into the gnat file naming system?

-- 
Peter Hermann Tel+49-711-685-3611 Fax3758 ica2ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
http://www.csv.ica.uni-stuttgart.de/homes/ph/
Team Ada: "C'mon people let the world begin" (Paul McCartney)



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: with child: access to parent
  2001-10-02 15:17       ` Wes Groleau
  2001-10-02 16:14         ` Peter Hermann
@ 2001-10-12 13:58         ` Simon Wright
  1 sibling, 0 replies; 15+ messages in thread
From: Simon Wright @ 2001-10-12 13:58 UTC (permalink / raw)


Wes Groleau <wwgrol@sparc01.ftw.rsc.raytheon.com> writes:

>                                                      But how many
> places actually take the trouble of removing unused withs? 

Since I started asking GNAT to tell me about unused things (-gnatwu),
I (we) do!

-- 
Simon Wright                         Email: simon.j.wright@amsjv.com
Alenia Marconi Systems                     Voice: +44(0)23 9270 1778
Integrated Systems Division                  FAX: +44(0)23 9270 1800



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2001-10-12 13:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-02 10:06 with child: access to parent Peter Hermann
2001-10-02 10:49 ` Pat Rogers
2001-10-02 12:53   ` Marc A. Criley
2001-10-02 14:25     ` Peter Hermann
2001-10-02 14:44       ` Pat Rogers
2001-10-02 14:10   ` Peter Hermann
2001-10-02 14:17     ` Ted Dennison
2001-10-02 15:17       ` Wes Groleau
2001-10-02 16:14         ` Peter Hermann
2001-10-12 13:58         ` Simon Wright
2001-10-02 14:22     ` Pat Rogers
2001-10-08 10:51       ` Jean-Pierre Rosen
2001-10-11 15:07         ` Peter Hermann
2001-10-11 14:54           ` Pat Rogers
2001-10-03  0:34     ` dale

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