Algebraic Data Types in D?
w0rp via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jul 31 06:03:52 PDT 2014
On Thursday, 31 July 2014 at 11:42:21 UTC, Remo wrote:
> http://tech.esper.com/2014/07/30/algebraic-data-types/
>
> D already has product type it is struct.
> But D lacks sum type also called tagged-union.
>
> Do you think it would be possible to add something like this to
> D2 ?
There is a library solution for this in the standard library.
http://dlang.org/phobos/std_variant.html#.Algebraic
It doesn't handle recursive types at the moment, like alias Foo =
Algebraic!(Foo[]). Apart from that, it should be what you are
looking for.
More information about the Digitalmars-d
mailing list