DIP 1002 (TryElseExpression) added to the queue
John Colvin via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 28 04:58:28 PDT 2016
On Wednesday, 28 September 2016 at 07:47:32 UTC, Andrei
Alexandrescu wrote:
> * The "Breaking changes" section should include how the
> following change in semantics would be addressed. Consider:
>
> try
> if (expression)
> try { ... }
> catch (Exception) { ... }
> else { ... }
> finally { ... }
>
> This code is currently legal and binds the "else" clause to the
> "if" and the "finally" to the first "try". The proposed feature
> will bind the "else" and the "finally" to the second try and
> then probably fail to compile because there is no "catch" or
> "finally" matching the first "try".
Yeah... that's a pain.
How about using different keywords:
try
{
// blah
}
/*else*/ catch (nothrow)
{
// on success.
}
More information about the Digitalmars-d
mailing list