is there a reason declarative style if are allowed, but not while ?

user1234 user1234 at 12.de
Tue Mar 2 16:24:18 UTC 2021


On Monday, 1 March 2021 at 15:20:10 UTC, deadalnix wrote:
> On Sunday, 28 February 2021 at 14:32:32 UTC, Timon Gehr wrote:
>> I don't think there's any good reason.
>>
>> Related: https://issues.dlang.org/show_bug.cgi?id=16140
>>
>> FWIW, note that this works in C++.
>
> Is there a way to expedite this? This seems like an obvious 
> improvement.

This may requires a DIP. Occasionally small languages changes are 
accepted without so you might try a PR, then if you're said that 
a DIP is required you can mention in the document that there's a 
draft PR. Finally this also could be a a candicate for a 
"-preview" feature.

It's also interesting to note that for the IfStatement, a 
declaration is allowed because from the AST point of view you 
just need a supplmental storage class.
So you have a "StorageClass Expression" not  "Expression | 
VariableDeclaration".
For the WhileStatement that should be implemented in the same 
fashion.


More information about the Digitalmars-d mailing list