`static switch` statement?

jmh530 john.michael.hall at gmail.com
Tue Sep 17 01:32:04 UTC 2019


On Tuesday, 17 September 2019 at 01:05:28 UTC, Andrei 
Alexandrescu wrote:
> On 9/16/19 6:41 PM, octo wrote:
>> `static switch` would make a nice addition to `static if`, 
>> `static foreach`, etc.
>> 
>> Any thoughts?
>
> It doesn't seem to add power to the language. [snip]

Wouldn't it add the comparable amount of power on the 
compile-side that the run-time switch statement adds? Run-time 
switch can be reconstructed as a series of if statements, same 
thing as compile-time switch.

I am not sure I would use the feature, but it reminds me of some 
attributes being preprended with @ and others not. It's just one 
of those quirks of the language.


More information about the Digitalmars-d mailing list