Improvements to switch
Basile B.
b2.temp at gmx.com
Tue Apr 16 16:00:48 UTC 2024
On Tuesday, 16 April 2024 at 10:34:21 UTC, ryuukk_ wrote:
> It is time to make them nice to use
>
>
> - allow them as expression
>
> ```D
> int myvalue = switch(code) {
> // ...
> };
>
> ```
About this, the main point is rather
```d
/*-->*/ const /*<--*/ int myvalue = switch(code) {
// ...
};
```
"ah finally you can define a const var decl that relies on
branching" (without using the conditional expression...)
Then there's something you must think about, that's the fallback,
i.e the default
clause. If you use the default clause to error you're lucky
because D has noreturn now.
More information about the dip.ideas
mailing list