On 22.11.2016 20:05, Meta wrote:
On Tuesday, 22 November 2016 at 15:11:04 UTC, Sönke Ludwig wrote:
Am 21.11.2016 um 22:19 schrieb Timon Gehr:
3 is ambiguous.

Can you give an example?

I'm curious as well. I considered that option 3 might be ambiguous but I
managed to convince myself that it wouldn't be. I'm guessing you're
referring to the fact that:

    //function body

Is a delegate literal, which could conceivably conflict with Option 3's

void fun(ref int n)
in { assert(n > 0); }
out { assert(n > 0); }
{ //Is this a syntax error or an immediately executed delegate literal?
    n += 1;

Function declarations don't necessarily have a body, but they might have contracts. (This is currently not allowed for technical reasons, but it should/will be.) But this is a rather minor point (usually you don't want to have contracts without implementation in a context where something starting with '{' is allowed).

The more important point is that there is no precedent where {...}{...} are two components of the same entity, it looks ugly even with the space-wasting convention where '{' is put on its own line. Not all contracts are one-liners like in your example above (which looks almost tolerable).

Reply via email to