braceless with statements

Stefan Koch uplink.coder at googlemail.com
Fri Nov 12 11:14:17 UTC 2021


On Friday, 12 November 2021 at 11:05:54 UTC, Dennis wrote:
> On Friday, 12 November 2021 at 10:55:21 UTC, Stefan Koch wrote:
>> It is a really simple patch and I think it's worthwhile to 
>> have this in the main language.
>
> How about other statements, like `if`, `for`, `foreach`, 
> `switch`? When extending `attribute:` syntax to statements, 
> might as well include all of them for consistency. N.b. this is 
> already allowed in global scope:
> ```D
> static if (true):
> ```
> Not in function scope though.

I am not proposing anything grand like that.
I don't think it has a very good fit for `if` or `for`
Since their scope tends to end before their parent block scope.


More information about the Digitalmars-d mailing list