On Sunday, 6 May 2018 at 19:18:02 UTC, Paul Backus 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`.
Code examples are available in the documentation (linked below).
New in this release:
- The list of types allowed in a sum type is now public
- Implicit qualifier conversions are now allowed in pattern
matching
- Better code examples in the documentation
This library is a work in progress. If you have a use case
you'd like to see supported, or an API you'd like to see
implemented, please get in touch!
Documentation: https://pbackus.github.io/sumtype/sumtype.html
DUB: https://code.dlang.org/packages/sumtype
Github: https://github.com/pbackus/sumtype
Yeeeees.
I love it when someone else goes and implements something that
was on my TODO stack. Dmitry Olshansky did it last week with
Photon, then you come along and take another item from me as
well. Less work for me!
Good work, definitely going to try this out.