DIP 1002 (TryElseExpression) added to the queue

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 28 16:44:19 PDT 2016


On 9/28/16 7:40 PM, Andrei Alexandrescu wrote:
>
> // With scope
> void assertNot(string s)
> {
>     try { scope(success) assert(0, s); decode(s,DecodeMode.STRICT); }
>     catch (DecodeException e) {}
> }

Sorry, this is not semantically equivalent. Replace with:

// With scope
void assertNot(string s)
{
     try { decode(s,DecodeMode.STRICT); }
     catch (DecodeException e) { return; }
     assert(0, s);
}


Andrei



More information about the Digitalmars-d mailing list