Structural exhaustive matching

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 21 08:55:06 PDT 2015


Jadbox:

> I'm curious on what the best way to do ADTs in D.

Sometimes there's no best way, there are several alternative ways 
with different tradeoffs. D isn't a functional language and 
there's no really good way to do ADTs in D. You can use plus a 
"final switch". Or you can use Algebraic from Phobos. Sometimes 
you can use another Phobos function that simulates an improved 
switch. Or often you can just give up at using ADTs in D and use 
what other solutions D offers you (like OOP).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list