May 08, 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
May 08, 2020
On Thursday, 7 May 2020 at 20:12:03 UTC, learner wrote:
>
> Modules of D standard library aren't in a good shape, if everyone suggests alternatives for a basic building block as variant.

I don't think Variant as a whole is the problem, when one uses it as the infinite variant it does fairly much what one can expect. The finite-field specialization of it is the one that's badly implemented.

>
> The types VariantN can hold are known at compile time, why can't it be specialized?

It could, probably. This shows the biggest weakness (and strength) of D development: It's voluntary, so people work on that they happen to want to. That makes it unevenly developed compared to financially backed projects. We have both plenty of cool & rare features and lack of many relatively basic ones at the same time.
1 2
Next ›   Last »