From: Oliver Kellogg <okellogg@users.sourceforge.net>
Subject: "shadow" package hierarchy using renaming of child packages
Date: Sun, 30 Jun 2013 00:00:18 -0700 (PDT)
Date: 2013-06-30T00:00:18-07:00 [thread overview]
Message-ID: <63a787e1-c3d9-4bfd-a7e6-6ff0f0c8236b@googlegroups.com> (raw)
Hi,
I was quite amazed to find that GNAT lets me rename a child package
of one hierarchy to a child package of a different hierarchy (i.e. having a different root.)
Does this work on other compilers too?
Thanks,
Oliver
-- file: foo.ads (original root package)
package Foo is
type T is new Integer;
end Foo;
-- file: foo-child.ads
package Foo.Child is
function Create return T;
end Foo.Child;
-- file: foo-child.adb
package body Foo.Child is
function Create return T is
begin
return 0;
end Create;
end Foo.Child;
-- file: shadow.ads (a different root package)
with Foo;
package Shadow is
subtype T is Foo.T;
type Other_Stuff is range 999 .. 1000;
end Shadow;
-- file: shadow-child.ads
with Foo.Child;
package Shadow.Child renames Foo.Child;
-- file: test_shadow.adb
with Shadow.Child;
procedure Test_Shadow is
I : Shadow.T := Shadow.Child.Create;
begin
null;
end Test_Shadow;
next reply other threads:[~2013-06-30 7:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-30 7:00 Oliver Kellogg [this message]
2013-06-30 20:43 ` "shadow" package hierarchy using renaming of child packages AdaMagica
2013-07-01 1:34 ` Shark8
2013-07-01 5:46 ` J-P. Rosen
2013-07-01 16:31 ` Adam Beneschan
2013-07-01 8:29 ` Oliver Kellogg
2013-07-01 9:37 ` AdaMagica
2013-07-01 11:14 ` Oliver Kellogg
2013-07-01 8:21 ` AdaMagica
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox