scope() statements and return

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 2 21:40:53 PDT 2014


On Friday, 3 October 2014 at 03:23:25 UTC, Ali Çehreli wrote:
> On 10/02/2014 07:17 PM, Shammah Chancellor wrote:
>> Per the documentation (http://dlang.org/statement.html) scope 
>> statements
>> are not precluded from returning, but DMD does not allow for 
>> it.
>> Should the documentation be updated?
>>
>> -S
>>
>
> Can you show a piece of code. The following quote says "may not 
> exit with [...] return":
>
> "A scope(exit) or scope(success) statement may not exit with a 
> throw, goto, break, continue, or return; nor may it be entered 
> with a goto."
>
> Ali

The throw thing is rather stupid, as the scope statement can call 
arbitrary function that can itself throw.


More information about the Digitalmars-d mailing list