Deprecate case-variables
Walter Bright
newshound2 at digitalmars.com
Sun May 14 23:11:25 UTC 2023
https://github.com/dlang/dmd/pull/14829
Case variables are:
"The case expressions in ArgumentList are a comma separated list of expressions.
Each expression must evaluate to a compile-time value or array, or a **runtime
initialized const or immutable variable of integral type**. Each expression must
be implicitly convertible to the type of the switch Expression.
Compile-time case values must all be distinct. Const or immutable runtime
variables must all have different names. If two case expressions share a value,
the first case statement with that value gets control."
https://dlang.org/spec/statement.html#switch-statement
Should we deprecate the case variables?
Pro: for the sake of simplicity, as it is a surprising and presumably
little-used feature.
Con: people don't like breaking existing code, and the feature isn't causing any
known problems.
I hope we can reach consensus.
More information about the Digitalmars-d
mailing list