comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.invalid>
Subject: Re: Generic instantiation before actual subprogram body
Date: Thu, 04 Dec 2014 11:40:43 +0100
Date: 2014-12-04T11:40:43+01:00	[thread overview]
Message-ID: <m5pdmr$b9i$1@dont-email.me> (raw)
In-Reply-To: <slrnm80cc9.nrc.lithiumcat@nat.rebma.instinctive.eu>

On 04.12.14 11:03, Natasha Kerensikova wrote:
> package body Which_Does_Not_Raise_Program_Error is
>
>     procedure Local_Procedure;
>
>     procedure Local_Procedure is
>     begin
>        <some code here>
>     end Local_Procedure;
>
>     procedure Instantiated is new Generic_Procedure (Local_Procedure);
>
>     procedure Public_Procedure is
>     begin
>        Instantiated;
>     end Public_Procedure;
>
> end Which_Does_Not_Raise_Program_Error;


While the following does not answer the question, Ada's "separate" facility
can provide for some source text reordering. It can keeping bodies out
of sight when they are not needed to be seen by the reader. Maybe this helps:

package body Which_Does_Not_Raise_Program_Error is

    procedure Local_Procedure;  -- or drop this

    procedure Local_Procedure is separate;

    procedure Instantiated is new Generic_Procedure (Local_Procedure);

    procedure Public_Procedure is
    begin
       Instantiated;
    end Public_Procedure;

end Which_Does_Not_Raise_Program_Error;

separate (Which_Does_Not_Raise_Program_Error)
procedure Local_Procedure is
begin
    null;
end Local_Procedure;

  reply	other threads:[~2014-12-04 10:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04  8:48 Generic instantiation before actual subprogram body Natasha Kerensikova
2014-12-04  9:31 ` J-P. Rosen
2014-12-04 10:03   ` Natasha Kerensikova
2014-12-04 10:40     ` Georg Bauhaus [this message]
2014-12-04 14:12     ` J-P. Rosen
2014-12-04 15:34     ` Robert A Duff
2014-12-04 15:49 ` Robert A Duff
2014-12-04 22:49   ` Randy Brukardt
replies disabled

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