variant visit not pure?
Dukc
ajieskola at gmail.com
Fri May 8 19:21:47 UTC 2020
On Thursday, 7 May 2020 at 15:36:36 UTC, Ben Jones wrote:
> I've been using SumType... What are the main differences
> between it and TaggedAlgebraic?
I have not used the the algebraic type of Taggedalgebraic tbh,
but it also has a tagged union type that I have good experiences
with. Unlike Phobos algebraic or SumType, it can have multiple
fields of same type that are still separate by the tag value.
Also unlike the two others I mentioned, you can handily define a
`Void` field (or many of them) if you want special values for the
tag that don't come with a value. In essence,
`Taggedalgebraic.TaggedUnion` it's the D equivalent of Rust
`enum`[1].
1: https://doc.rust-lang.org/book/ch06-00-enums.html
More information about the Digitalmars-d-learn
mailing list