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.
}


Reply via email to