Skip to content

Instantly share code, notes, and snippets.

@flyx
Last active December 20, 2015 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flyx/6099315 to your computer and use it in GitHub Desktop.
Save flyx/6099315 to your computer and use it in GitHub Desktop.
-- compilation unit 1:
generic
type T is private;
package Unit is
-- ...
end Unit;
-- compilation unit 2:
generic
type T2 is private;
package Unit.Child is
-- ...
end Unit.Child;
-- compilation unit 3:
with Unit.Child; -- neccessary, but GNAT says it's unreferenced.
generic
type T2 is private;
package Specialization is
package Base is new Unit (T2);
generic package Child renames Base.Child;
end Specialization;
-- compilation unit 4:
with Specialization;
procedure Test is
package Instance is new Specialization;
package Instance_Child is new Instance.Child;
-- if I didn't rename the generic package, I'd need to do:
-- package Instance_Child is new Instance.Base.Child;
begin
null;
end Test;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment