comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Optional body for nested generic
Date: Tue, 20 Sep 2011 13:48:48 +0100
Date: 2011-09-20T13:48:48+01:00	[thread overview]
Message-ID: <m262kn2xcf.fsf@pushface.org> (raw)

I was surprised to find that GNAT makes it optional to have a body for a
nested generic package (in the code below, gpack1 has an empty body,
gpack2 doesn't have a body at all).

package Pack is
   pragma Elaborate_Body;
   generic
   package Gpack1 is
      procedure Proc;
      pragma Import (C, Proc, "proc");
   end Gpack1;
   generic
   package Gpack2 is
      procedure Proc;
      pragma Import (C, Proc, "proc");
   end Gpack2;
end Pack;

package body Pack is
   package body Gpack1 is
   end Gpack1;
end Pack;

I suppose that the reasoning for disallowing unrequired bodies (roughly,
making it impossible to obsolete the ada library by adding/removing
something with no other impact) only applies at library level, where
there's a correspondence to a file?



             reply	other threads:[~2011-09-20 12:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20 12:48 Simon Wright [this message]
2011-09-20 15:00 ` Optional body for nested generic Adam Beneschan
2011-09-20 15:18   ` Simon Wright
2011-09-20 15:15 ` Robert A Duff
2011-09-21 15:01   ` Adam Beneschan
2011-09-22  3:43     ` Randy Brukardt
2011-09-22 14:28       ` Robert A Duff
2011-09-22 23:03         ` Randy Brukardt
2011-09-23  0:03           ` Adam Beneschan
replies disabled

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