From: Oliver Kellogg on
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
From: Dmitry A. Kazakov on
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
From: Oliver Kellogg on
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