* global package scope designator?
@ 2010-04-05 7:39 Oliver Kellogg
2010-04-05 7:54 ` Dmitry A. Kazakov
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kellogg @ 2010-04-05 7:39 UTC (permalink / raw)
In C++, a leading "::" before a reference to a namespace denotes the
global namespace.
There does not seem to be an equivalent for this in Ada.
I now ran into a situation where I felt this to be a lack.
Here is an example (the original problem involved packages nested three
levels deep which I reduced here to two levels for simplicity):
-- File: gui.ads
package gui is
type Obj is new Integer;
end gui;
-- File: mcc.ads
package mcc is
end mcc;
-- File: mcc-gui.ads
package mcc.gui is
function F return Natural;
end mcc.gui;
-- File: mcc-gui.adb
with gui;
package body mcc.gui is
function F return Natural is
begin
return gui.Obj'Size;
end F;
end mcc.gui;
$ gcc -c mcc-gui.adb
$ mcc-gui.adb:6:17: "Obj" not declared in "gui"
The package mcc.gui hides the library level package gui.
In C++, we could write
::gui::obj
to denote the desired namespace.
Is this something that would be worth adding in a future revision of Ada?
Thanks,
Oliver
P.S. For the original problem, see
http://svn.savannah.gnu.org/viewvc?view=rev&root=rapid&revision=87
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: global package scope designator?
2010-04-05 7:39 global package scope designator? Oliver Kellogg
@ 2010-04-05 7:54 ` Dmitry A. Kazakov
2010-04-05 8:01 ` Oliver Kellogg
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry A. Kazakov @ 2010-04-05 7:54 UTC (permalink / raw)
On Mon, 5 Apr 2010 09:39:33 +0200, Oliver Kellogg wrote:
> The package mcc.gui hides the library level package gui.
>
> In C++, we could write
> ::gui::obj
> to denote the desired namespace.
In Ada you do:
Standard.GUI.Obj
See ARM 10.1.1(1)
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: global package scope designator?
2010-04-05 7:54 ` Dmitry A. Kazakov
@ 2010-04-05 8:01 ` Oliver Kellogg
0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kellogg @ 2010-04-05 8:01 UTC (permalink / raw)
On Mon, 05 Apr 2010 09:54:18 +0200, Dmitry A. Kazakov wrote:
> On Mon, 5 Apr 2010 09:39:33 +0200, Oliver Kellogg wrote:
>
>> The package mcc.gui hides the library level package gui.
>>
>> In C++, we could write
>> ::gui::obj
>> to denote the desired namespace.
>
> In Ada you do:
>
> Standard.GUI.Obj
>
> See ARM 10.1.1(1)
Ah, thanks!
Oliver
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-05 8:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-05 7:39 global package scope designator? Oliver Kellogg
2010-04-05 7:54 ` Dmitry A. Kazakov
2010-04-05 8:01 ` Oliver Kellogg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox