Bitblob (hash wrapper) & Minivariant (tagged union) dub packages

Paul Backus snarwin at
Tue Jan 22 18:09:16 UTC 2019

On Tuesday, 22 January 2019 at 10:26:33 UTC, Mathias Lang wrote:
> ## Minivariant
> Minivariant is a "works for me" replacement of `std.variant : 
> Algebraic`.
> [...]
> I looked into fixing it, but given Variant's design (which 
> relies heavily on `TypeInfo`) it would have been a wild goose 
> chase. And I know I'm not the only one that needed his own 
> tagged union (see e.g. 
> It also has a 
> `visit` method similar to std.variant, although not with 
> delegates, as there is currently no way to merge delegates into 
> an overload set, so you have to use an existing overload set 
> (see the examples).

I've also been through this exact process. The resulting package 
is on dub as `sumtype` [1]. In addition to solving the problem 
you noticed with `immutable`, it also works with @safe, @nogc, 
pure, and nothrow, and supports both delegates and overload sets 
with its `match` method (the equivalent of `visit`).


More information about the Digitalmars-d-announce mailing list