Extend D's switch statement?

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 8 01:31:40 PDT 2015


On Wednesday, 8 July 2015 at 07:15:27 UTC, Yuxuan Shui wrote:
> I think it will be useful to extent switch statement to support 
> any type that implements opEquals and opHash.
>
> Is there any technical difficulties to implement this?

Hardly anyone wants switch to be a better if-else ladder.
https://issues.dlang.org/show_bug.cgi?id=5862
Many would like it to support pattern matching though.
http://wiki.dlang.org/DIP32#Various_places_that_you_can_use_unpacking_and_pattern_matching


More information about the Digitalmars-d mailing list