std.sumtype?

Atila Neves atila.neves at gmail.com
Fri Mar 26 02:56:29 UTC 2021


On Thursday, 25 March 2021 at 15:05:40 UTC, Paul Backus wrote:
> On Thursday, 25 March 2021 at 14:28:06 UTC, Atila Neves wrote:

>> I think it's useful to remember that in languages where sum 
>> types and pattern matching are features there's no way to do 
>> this.
>
> I suspect the big reason is that a lot of D programmers aren't 
> super familiar with these languages, or with functional 
> programming in general, so they find SumType's match function 
> less comfortable and approachable

Completely plausible but in my opinion not nearly enough of a 
reason to offer an escape hatch.

> than switching on an enum (even though it's fundamentally the 
> same thing).

Matching is like *final* switching on the enum, except that's 
that the only thing you can do so you can't screw up.




More information about the Digitalmars-d mailing list