* package child question
@ 2000-02-07 0:00 Georg Bauhaus
2000-02-07 0:00 ` Jean-Pierre Rosen
2000-02-08 0:00 ` Matthew Heaney
0 siblings, 2 replies; 13+ messages in thread
From: Georg Bauhaus @ 2000-02-07 0:00 UTC (permalink / raw)
Hello,
I wonder if someone could help me pointing out to me what I've done
wrong in the following two library hierarchies; the first has
a parent and a child, not withing anything, while the second
hierarchy's child body withes the child of the first, like this:
package A is
end A;
package A.B is
end A.B;
package B is
end B;
package B.A is
pragma Elaborate_Body;
end B.A;
with A.B;
package body B.A is
begin
declare
use A.B; -- compiler says: "B" not declared in "A"
begin
null;
end;
end B.A;
This only happens if the use clause is in A.B body statements,
there is no error message when it is in the context clause of A.B.
Is there a way out of this, other than choosing different names
(which works)?
Georg Bauhaus
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-07 0:00 package child question Georg Bauhaus
@ 2000-02-07 0:00 ` Jean-Pierre Rosen
2000-02-08 0:00 ` Steve Folly
2000-02-08 0:00 ` Matthew Heaney
1 sibling, 1 reply; 13+ messages in thread
From: Jean-Pierre Rosen @ 2000-02-07 0:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
Georg Bauhaus <sb463ba@d250-hrz.uni-duisburg.de> a �crit dans le message :
87mugk$sa3$1@news-hrz.uni-duisburg.de...
> with A.B;
> package body B.A is
>
> begin
> declare
> use A.B; -- compiler says: "B" not declared in "A"
> begin
> null;
> end;
> end B.A;
>
> This only happens if the use clause is in A.B body statements,
> there is no error message when it is in the context clause of A.B.
> Is there a way out of this, other than choosing different names
> (which works)?
>
The closest 'A' that is visible is B.A, so you "use A.B" really means "use
B.A.B".
If you want to be absolutely, unambiguously sure of what you name, start
with Standard:
use Standard.A.B;
(unless you have also redefined locally Standard, but that would *really* be
looking for trouble :-)
--
---------------------------------------------------------
J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://pro.wanadoo.fr/adalog
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-07 0:00 ` Jean-Pierre Rosen
@ 2000-02-08 0:00 ` Steve Folly
2000-02-09 0:00 ` Jean-Pierre Rosen
0 siblings, 1 reply; 13+ messages in thread
From: Steve Folly @ 2000-02-08 0:00 UTC (permalink / raw)
Jean-Pierre Rosen <rosen.adalog@wanadoo.fr> wrote, among other things, in
message news:87oi6t$jd$1@wanadoo.fr...
>
> If you want to be absolutely, unambiguously sure of what you name, start
> with Standard:
> use Standard.A.B;
>
> (unless you have also redefined locally Standard, but that would *really*
be
> looking for trouble :-)
>
Just a minor point... as all packages are implicitly child packages of
Standard, you don't actually have to with Standard - just the use clause
will work.
We had a problem like this with some code at work...
package Icp_Button is
...
end Icp_Button;
package Icp_Button.Field is
...
end Icp_Button.Field;
package Field is
...
end Field;
Any reference to the package Field in Icp_Button.Field has to be qualified
with Standard.
OK, maybe the names of the packages were badly chosen, but we wont argue
about that....
--
Regards,
Steve Folly.
http://www.follysplace.demon.co.uk
donationsto:myaccount@mybank.co.uk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-08 0:00 ` Steve Folly
@ 2000-02-09 0:00 ` Jean-Pierre Rosen
2000-02-09 0:00 ` Georg Bauhaus
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Jean-Pierre Rosen @ 2000-02-09 0:00 UTC (permalink / raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]
Steve Folly <steve@follysplace.demon.co.uk> a �crit dans le message :
950043074.13382.0.nnrp-08.c2de848f@news.demon.co.uk...
>
> Jean-Pierre Rosen <rosen.adalog@wanadoo.fr> wrote, among other things, in
> message news:87oi6t$jd$1@wanadoo.fr...
> >
> > If you want to be absolutely, unambiguously sure of what you name, start
> > with Standard:
> > use Standard.A.B;
> >
> > (unless you have also redefined locally Standard, but that would
*really*
> be
> > looking for trouble :-)
> >
>
> Just a minor point... as all packages are implicitly child packages of
> Standard, you don't actually have to with Standard - just the use clause
> will work.
>
A funny and unfortunate effect of automatic lines folding!
I wrote "start with Standard", I didn't suggest to have a "with standard;".
As an evidence of my innocence, notice that the word "Standard" is followed
by a colon, not a semi-colon :-)
--
---------------------------------------------------------
J-P. Rosen (Rosen.Adalog@wanadoo.fr)
Visit Adalog's web site at http://pro.wanadoo.fr/adalog
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-09 0:00 ` Jean-Pierre Rosen
@ 2000-02-09 0:00 ` Georg Bauhaus
2000-02-09 0:00 ` Robert A Duff
2000-02-11 0:00 ` Steve Folly
2 siblings, 0 replies; 13+ messages in thread
From: Georg Bauhaus @ 2000-02-09 0:00 UTC (permalink / raw)
Thank you for all the answers!
Matthew Heaney's renaming solution worked (well, of course?)
when prefixed with A.B;
Georg Bauhaus
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-09 0:00 ` Jean-Pierre Rosen
2000-02-09 0:00 ` Georg Bauhaus
@ 2000-02-09 0:00 ` Robert A Duff
2000-02-10 0:00 ` Ehud Lamm
2000-02-11 0:00 ` Steve Folly
2 siblings, 1 reply; 13+ messages in thread
From: Robert A Duff @ 2000-02-09 0:00 UTC (permalink / raw)
"Jean-Pierre Rosen" <rosen.adalog@wanadoo.fr> writes:
> A funny and unfortunate effect of automatic lines folding!
> I wrote "start with Standard", I didn't suggest to have a "with standard;".
Well, *I* understood what you said. Besides, "with" is not a verb in
English. Why did JDI choose it, instead of, say, "use" or "import"?
The RM says "mention in a with clause", but that's too long, so people
say "to with, or not to with". ;-)
- Bob
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-09 0:00 ` Robert A Duff
@ 2000-02-10 0:00 ` Ehud Lamm
2000-02-09 0:00 ` Marin D. Condic
0 siblings, 1 reply; 13+ messages in thread
From: Ehud Lamm @ 2000-02-10 0:00 UTC (permalink / raw)
On Wed, 9 Feb 2000, Robert A Duff wrote:
|The RM says "mention in a with clause", but that's too long, so people
|say "to with, or not to with". ;-)
|
But "to use, or not to use" - that is the question!
Ehud Lamm mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <== My home on the web
Check it out and subscribe to the E-List- for interesting essays and more!
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-10 0:00 ` Ehud Lamm
@ 2000-02-09 0:00 ` Marin D. Condic
2000-02-10 0:00 ` Larry Kilgallen
0 siblings, 1 reply; 13+ messages in thread
From: Marin D. Condic @ 2000-02-09 0:00 UTC (permalink / raw)
Ehud Lamm wrote:
>
> On Wed, 9 Feb 2000, Robert A Duff wrote:
>
> |The RM says "mention in a with clause", but that's too long, so people
> |say "to with, or not to with". ;-)
> |
>
> But "to use, or not to use" - that is the question!
>
Or how about "instantiate" or "instantiation"? Ada has definitely
twisted a few English language words around. One wonders if Gen.
Alexander Haig was consulted on any of this, seeing as he was famous for
turning nouns into verbs, etc.
MDC
--
=============================================================
Marin David Condic - Quadrus Corporation - 1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at: http://www.mcondic.com/
"Capitalism without failure is like religion without sin."
-- Allan Meltzer, Economist
=============================================================
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-09 0:00 ` Marin D. Condic
@ 2000-02-10 0:00 ` Larry Kilgallen
2000-02-10 0:00 ` Pascal Obry
0 siblings, 1 reply; 13+ messages in thread
From: Larry Kilgallen @ 2000-02-10 0:00 UTC (permalink / raw)
In article <38A20732.F8119EBB@quadruscorp.com>, "Marin D. Condic" <mcondic-nospam@quadruscorp.com> writes:
> Ehud Lamm wrote:
>>
>> On Wed, 9 Feb 2000, Robert A Duff wrote:
>>
>> |The RM says "mention in a with clause", but that's too long, so people
>> |say "to with, or not to with". ;-)
>> |
>>
>> But "to use, or not to use" - that is the question!
>>
> Or how about "instantiate" or "instantiation"? Ada has definitely
> twisted a few English language words around. One wonders if Gen.
> Alexander Haig was consulted on any of this, seeing as he was famous for
> turning nouns into verbs, etc.
A more concise statement of:
> turning nouns into verbs
is:
verbing a noun
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-09 0:00 ` Jean-Pierre Rosen
2000-02-09 0:00 ` Georg Bauhaus
2000-02-09 0:00 ` Robert A Duff
@ 2000-02-11 0:00 ` Steve Folly
2 siblings, 0 replies; 13+ messages in thread
From: Steve Folly @ 2000-02-11 0:00 UTC (permalink / raw)
Jean-Pierre Rosen <rosen.adalog@wanadoo.fr> wrote in message
news:87rava$8dv$1@wanadoo.fr...
>
> >
> A funny and unfortunate effect of automatic lines folding!
> I wrote "start with Standard", I didn't suggest to have a "with
standard;".
> As an evidence of my innocence, notice that the word "Standard" is
followed
> by a colon, not a semi-colon :-)
>
Indeed, I bought some new eyes yesterday, and I can see fine now :-)
My apologies, Jean-Pierre.
--
Regards,
Steve Folly.
http://www.follysplace.demon.co.uk
donationsto:myaccount@mybank.co.uk
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: package child question
2000-02-07 0:00 package child question Georg Bauhaus
2000-02-07 0:00 ` Jean-Pierre Rosen
@ 2000-02-08 0:00 ` Matthew Heaney
1 sibling, 0 replies; 13+ messages in thread
From: Matthew Heaney @ 2000-02-08 0:00 UTC (permalink / raw)
In article <87mugk$sa3$1@news-hrz.uni-duisburg.de> ,
sb463ba@d250-hrz.uni-duisburg.de (Georg Bauhaus) wrote:
> with A.B;
> package body B.A is
>
> begin
> declare
> use A.B; -- compiler says: "B" not declared in "A"
> begin
> null;
> end;
> end B.A;
>
> This only happens if the use clause is in A.B body statements,
> there is no error message when it is in the context clause of A.B.
A name always denotes the entity with the most inner scope. In your
case, the name "A" denotes the package B.A, because that is the A-entity
declared in the most inner scope.
> Is there a way out of this, other than choosing different names
> (which works)?
You could try doing a library-level package renames:
-- this is its own file, say ab.ads
package AB renames A.B;
-- now with the renamed package:
with AB;
package body B.A is
begin
declare
use AB;
begin
null;
end;
end B.A;
I haven't tried compiling this, though.
--
Celebrate Darwin Day on Saturday, 12 February!
<http://www.bbc.co.uk/education/darwin/index.shtml>
^ permalink raw reply [flat|nested] 13+ messages in thread
* package child question
@ 2000-02-08 0:00 Christoph Grein
0 siblings, 0 replies; 13+ messages in thread
From: Christoph Grein @ 2000-02-08 0:00 UTC (permalink / raw)
To: comp.lang.ada
Matthew Heaney has pointed out the cause of your problem.
Apart from renaming, another solution is possible. Remember that any library
unit is supposed to be a child of Standard, so you might write
with A.B;
package body B.A is -- this A hides the imported one
begin
declare
use Standard.A.B; -- qualification makes it accessible again
begin
null;
end;
end B.A;
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2000-02-11 0:00 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-07 0:00 package child question Georg Bauhaus
2000-02-07 0:00 ` Jean-Pierre Rosen
2000-02-08 0:00 ` Steve Folly
2000-02-09 0:00 ` Jean-Pierre Rosen
2000-02-09 0:00 ` Georg Bauhaus
2000-02-09 0:00 ` Robert A Duff
2000-02-10 0:00 ` Ehud Lamm
2000-02-09 0:00 ` Marin D. Condic
2000-02-10 0:00 ` Larry Kilgallen
2000-02-10 0:00 ` Pascal Obry
2000-02-11 0:00 ` Steve Folly
2000-02-08 0:00 ` Matthew Heaney
-- strict thread matches above, loose matches on Subject: below --
2000-02-08 0:00 Christoph Grein
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox