sumtype 0.9.0: BetterC and DIP 1000 support

Paul Backus snarwin at gmail.com
Sat Sep 28 21:28:00 UTC 2019


SumType is a generic sum type for modern D. It is designed to be 
an improved
alternative to `std.variant.Algebraic`.

Features:
   - Pattern matching, including support for introspection-based 
matching (★)
   - Self-referential types, using `This`
   - Works with `pure`, `@safe`, `@nogc`, `nothrow`, and 
`immutable` (★)
   - Compatible with `-betterC` and `-dip1000` (★)
   - 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 since the last announced version, 0.8.3:
   - SumType is now fully compatible with DIP 1000 and BetterC!
   - `match` no longer ignores implicit conversions when matching 
handlers to
     types.
   - Assigning to a SumType that contains pointers is now 
(correctly) @system.
   - Self-referential SumTypes can now be nested.
   - Invariants of SumType members are now checked.
   - Static arrays in SumTypes are now copied correctly.
   - `match` now takes template overloads of handlers into account.
   - Numerous other bug fixes and improvements.

Special thanks to George Zakhour for his contributions to this 
release.

Links:
   - Documentation: https://pbackus.github.io/sumtype/sumtype.html
   - DUB: https://sumtype.dub.pm
   - Github: https://github.com/pbackus/sumtype


More information about the Digitalmars-d-announce mailing list