sumtype 0.7.0

H. S. Teoh hsteoh at quickfur.ath.cx
Thu Nov 22 00:02:18 UTC 2018


On Wed, Nov 21, 2018 at 12:38:25AM +0000, Paul Backus via Digitalmars-d-announce wrote:
> SumType is a generic sum type for modern D. It is meant as an
> alternative to `std.variant.Algebraic`.
> 
> Features:
>   - Pattern matching, including support for structural matching (★)
>   - Self-referential types, using `This`
>   - Works with pure, @safe, @nogc, and immutable (★)
>   - Zero runtime overhead compared to hand-written C
>     - No heap allocation
>     - Does not rely on runtime type information (`TypeInfo`) (★)
> 
> Starred features (★) are those that are missing from `Algebraic`.
[...]

Took a quick look at this.  Wow!  Excellent job!  Very nicely-designed
API, much better than std.variant.* IMO.

Any way this could be expanded to arbitrary types like Variant? Or is
that not possible without reverting to TypeInfo dependency?


T

-- 
Why have vacation when you can work?? -- EC


More information about the Digitalmars-d-announce mailing list