From: Oliver Kellogg <okellogg@users.sourceforge.net>
Subject: global package scope designator?
Date: Mon, 5 Apr 2010 09:39:33 +0200
Date: 2010-04-05T09:39:33+02:00 [thread overview]
Message-ID: <hpc43l$c71$03$1@news.t-online.com> (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
next reply other threads:[~2010-04-05 7:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-05 7:39 Oliver Kellogg [this message]
2010-04-05 7:54 ` global package scope designator? Dmitry A. Kazakov
2010-04-05 8:01 ` Oliver Kellogg
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox