comp.lang.ada
 help / color / mirror / Atom feed
* controlled types and point of instanciation
@ 2018-03-16 14:39 Mehdi Saada
  2018-03-16 16:31 ` J-P. Rosen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mehdi Saada @ 2018-03-16 14:39 UTC (permalink / raw)


I make the humble request of an exegesis of this text: (from ada 95 the craft of oriented programming)
"Since Ada.Finalization.Limited_Controlled and Ada.Finalization.Controlled are both library-level types, all controlled types must be derived by instantiation at library level. Since generic packages are treated as being declared at the point of instantiation, this means that JE.Lists can only be instantiated at library level, usually within the specification of another library package. This means that we can no longer use JE.Lists to build opaque types as [bellow]. Instantiating JE.Lists inside a package body is no longer permissible."

--> it refers to that:
package JE.Stacks is
-- anything
private
   type Stack_Item;
   type Stack_Type is access Stack_Item;
end JE.Stacks;

with JE.Lists;
package body JE.Stacks is
   package Lists is new JE.Lists (Item_Type);
   type Stack_Item is
   record
      L : Lists.List_Type;
   end record;
... end JE.STACKS;

So that I can grasp the rule better, what are the anomalous cases this rule wants to avoid ?

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-17  0:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 14:39 controlled types and point of instanciation Mehdi Saada
2018-03-16 16:31 ` J-P. Rosen
2018-03-16 17:14   ` Mehdi Saada
2018-03-16 18:06 ` Mehdi Saada
2018-03-16 21:44   ` Jeffrey R. Carter
2018-03-17  0:54 ` Mehdi Saada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox