Improve "Improve Contract Syntax" DIP 1009

user1234 user1234 at 12.ie
Thu Nov 2 20:37:11 UTC 2017


On Thursday, 2 November 2017 at 08:58:03 UTC, codephantom wrote:
> Now, I'm new to D (I only discovered it a month or so 
> ago)...but do free floating statements already exist in the 
> language?

There's this one:

void main() {
     int i;
     switch (i)
         default: break;
}

you have 3 non-ambiguous and contiguous statements without a 
block: a switch, a default case (the "free-floating" one) and a 
break. Now why is this allowed is another story ;)

The whole combination makes sense just like :

function ...
in ...
out ...
do {}

would.


More information about the Digitalmars-d mailing list