why scope(success)?
Derek Parnell
derek at psych.ward
Wed May 10 15:46:31 PDT 2006
On Thu, 11 May 2006 08:13:37 +1000, Sean Kelly <sean at f4.ca> wrote:
> Chris Miller wrote:
>> This gives me an idea, how about if there was scope(none) that is just
>> like a regular block, but doesn't create a new scope. This would be for
>> when you only need to group statements but have no interest in a new
>> scope.
>> void foo()
>> {
>> if(a) scope(none) { stuff(); scope(success) bar(); }
>> baz();
>> }
>> bar() would execute after baz();
>
> It's a nasty hack, but:
>
> if(!a) goto blah;
> scope(success) a.foo();
> blah:
> ...
And I guess this is just as nasty ...
scope(success) if (a) a.foo();
--
Derek Parnell
Melbourne, Australia
More information about the Digitalmars-d
mailing list