[Issue 11070] Allow declaration statement in a switch expression
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 8 11:11:29 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=11070
Basile-z <b2.temp at gmx.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |b2.temp at gmx.com
--- Comment #13 from Basile-z <b2.temp at gmx.com> ---
It was not the case in the 2013 but 10 years later adding this feature is a
failure to recognize the more general pattern: the VarDecl as used in this
proposal could be a primary expression and should not be tied to specific
statements.
1. First this was possible as IfStatement condition.
2. Then it was added as WhileStatement condition
3. Now it will be added as SwitchStatement condition
4. In the future someone will realize that
- this is useful to deconstruct tuples
- this is useful in AndEnExpression and OrOrExpression
- this is useful in the CallExpression for the `out` parameters
etc. etc.
Making the new primary would fix that in one shot.
--
More information about the Digitalmars-d-bugs
mailing list