comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Ada2012 : Expression functions and extended return statements
Date: Mon, 9 Jan 2012 00:16:01 -0600
Date: 2012-01-09T00:16:01-06:00	[thread overview]
Message-ID: <jee0n3$hkg$1@munin.nbi.dk> (raw)
In-Reply-To: 1bjpifgqn93x.yp3mckcm2qds$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message 
news:1bjpifgqn93x.yp3mckcm2qds$.dlg@40tude.net...
> On Sat, 7 Jan 2012 15:54:44 +0100, stefan-lucks@see-the.signature wrote:
>
>>    function Characters(I: Integer; Filler: Character := '_') return 
>> String is
>>    begin
>>       return Result: String(1..I) := (others => Filler) do
>>         return;
>>       end return;
>>    end Characters;
>
> OT: a return statement inside another return statement is funny.

It's funny, but allowed, for the same reason that it is useful in any 
decent-sized chunk of code -- sometimes you need to exit in the middle. 
Hopefully it won't happen very often.

>   return X : Boolean := True do -- Illegal, I hope
>      return False;
>   end return;

The "return False" is illegal, because the outer return has already 
specified the result. You can only use a return without an expression inside 
of an extended-return.

                                     Randy.





  parent reply	other threads:[~2012-01-09  6:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  8:45 Ada2012 : Expression functions and extended return statements Martin
2012-01-06  9:45 ` stefan-lucks
2012-01-06 10:02   ` Martin
2012-01-06 11:23     ` Peter C. Chapin
2012-01-06 11:37       ` Martin
2012-01-06 13:13         ` Dmitry A. Kazakov
2012-01-06 14:45           ` Martin Dowie
2012-01-06 15:07             ` Martin
2012-01-06 16:40             ` Robert A Duff
2012-01-06 17:04               ` Martin Dowie
2012-01-19  7:47               ` David Thompson
2012-01-06 17:20             ` Dmitry A. Kazakov
2012-01-07  1:47               ` Randy Brukardt
2012-01-07  9:21                 ` Dmitry A. Kazakov
2012-01-06 16:45           ` Adam Beneschan
2012-01-06 16:36     ` Adam Beneschan
2012-01-07 14:54     ` stefan-lucks
2012-01-07 15:11       ` Dmitry A. Kazakov
2012-01-08  9:41         ` stefan-lucks
2012-01-09  6:16         ` Randy Brukardt [this message]
2012-01-06 15:11   ` J-P. Rosen
2012-01-06 15:26     ` Martin
2012-01-07  1:50       ` Randy Brukardt
2012-01-07 10:12         ` Martin
2012-01-07 12:22           ` Simon Wright
2012-01-07 17:10             ` Martin
2012-01-09  6:21           ` Randy Brukardt
2012-01-09  7:57             ` Martin Dowie
2012-01-31 23:34             ` Yannick Duchêne (Hibou57)
2012-01-06 16:33 ` Adam Beneschan
2012-01-06 16:38   ` Adam Beneschan
2012-01-06 22:12     ` Robert A Duff
2012-01-31 23:20 ` Yannick Duchêne (Hibou57)
replies disabled

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