draft proposal for Sum Types for D
jmh530
john.michael.hall at gmail.com
Tue Nov 29 11:56:08 UTC 2022
On Tuesday, 29 November 2022 at 06:26:20 UTC, Walter Bright wrote:
> Go ahead, Make My Day! Destroy!
>
> https://github.com/WalterBright/DIPs/blob/sumtypes/DIPs/1NNN-(wgb).md
One of the motivations for std.sumtype was that it was an
alternative to std.variant that has full attribute correctness
(@nogc/@safe/nothrow/pure) and betterC compatibility (as well as
handling const/immutable). It would be good to mention whether
these are also design goals of the DIP.
For that matter, std.variant (or std.typecons.Nullable) or other
somewhat similar D approaches ([1], [2], [3]) aren't mentioned as
part of the prior work. I don't think the DIP has to be a
replacement for all these things, but it can't hurt to look over
these other projects and see if there is anything in them that
would be useful to incorporate into the DIP.
[1]
https://github.com/libmir/mir-core/blob/master/source/mir/algebraic.d
[2] https://code.dlang.org/packages/taggedalgebraic
[3] https://code.dlang.org/packages/expected
More information about the Digitalmars-d
mailing list