comp.lang.ada
 help / color / mirror / Atom feed
From: Mehdi Saada <00120260a@gmail.com>
Subject: Re: body stub not allowed in inner scope
Date: Wed, 28 Feb 2018 07:26:29 -0800 (PST)
Date: 2018-02-28T07:26:29-08:00	[thread overview]
Message-ID: <ace36299-15fa-478f-9a9f-5484b9bfc92f@googlegroups.com> (raw)
In-Reply-To: <dee332fb-c791-4e81-ad0f-0e07220fc2b7@googlegroups.com>

I am aware of this. Sad but true. Eventhough those change in semantics might seem logical for a human being, it can become a nightmare to formulate and integrate with the preexisting rules.
I refactorized (is it the good term ?) my code, to put as much subprograms in a standalone package, and reduce the nested subprograms in the two cases where I really needed the context.
All is fine, EXCEPT I had to introduce an access to STRING where I wanted an inner block. It broke my heart.
Which gave me a main program like this:

with LEDIT; use LEDIT;
procedure MAIN is
   LINE: access constant String; -- EVIL!!
   CURSOR: NATURAL;
   procedure SEPARATE_NUMBER_AND_CONTENT is separate;
   procedure ANALYSE_LIST_COMMAND is separate;
begin
   while not END_OF_FILE(Standard_Input) loop
      LINE :=  new STRING'(TRIM(LET_ONLY_GRAPHIC_CHARACTERS(GET_LINE), LEFT));
...
   end loop;
   ...
end MAIN;

Whereas I wanted this, because SEPARTE... and ANALYSE... NEED to know about LINE, but can't be declared in a block.

while_loop
  declare
    LINE : STRING := PROCESSING(GET_LINE);
    BLABLA is separate;
  begin
    BLABLA;
  end;
end loop;

  parent reply	other threads:[~2018-02-28 15:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 13:01 body stub not allowed in inner scope Mehdi Saada
2018-02-28 13:32 ` AdaMagica
2018-02-28 14:30   ` Mehdi Saada
2018-02-28 14:39     ` AdaMagica
2018-02-28 23:23     ` Randy Brukardt
2018-03-01  7:14       ` J-P. Rosen
2018-03-01 22:38         ` Randy Brukardt
2018-03-02  7:14           ` J-P. Rosen
2018-03-02 10:17             ` Dmitry A. Kazakov
2018-03-02 22:10               ` Randy Brukardt
2018-03-03  3:38                 ` Dennis Lee Bieber
2018-03-02 22:13             ` Randy Brukardt
2018-03-02 19:37           ` G. B.
2018-03-02 19:47             ` Simon Wright
2018-03-03  9:42               ` G.B.
2018-03-01  8:20       ` Dmitry A. Kazakov
2018-03-01  8:24       ` Simon Wright
2018-03-01 20:52         ` Jacob Sparre Andersen
2018-03-01 22:45           ` Randy Brukardt
2018-03-01  8:38       ` Niklas Holsti
2018-03-01  9:11       ` Björn Lundin
2018-03-01 15:19       ` marciant
2018-03-01 17:37       ` Shark8
2018-02-28 15:26 ` Mehdi Saada [this message]
2018-02-28 15:28   ` Mehdi Saada
2018-02-28 23:32   ` Randy Brukardt
2018-03-01  0:16     ` Mehdi Saada
2018-02-28 17:24 ` Jeffrey R. Carter
2018-02-28 18:05   ` Simon Wright
2018-02-28 19:04     ` Jeffrey R. Carter
replies disabled

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