draft proposal for Sum Types for D
Paul Backus
snarwin at gmail.com
Wed Nov 30 04:09:10 UTC 2022
On Tuesday, 29 November 2022 at 20:18:02 UTC, H. S. Teoh wrote:
> Supporting ctors, postblits, and dtors does increase the
> complexity of the implementation. Perhaps that can be left as
> a future extension? In any case, eventually we should support
> it; otherwise sumtypes will be too limited in their usefulness.
Such support is already implemented in std.sumtype, so you can
review the code yourself if you would like to see how much
complexity it adds to the implementation.
Off the top of my head, I can tell you that most of the code
volume comes from having to copy and paste each function 4 times
to handle different mutability qualifiers (mutable, const,
immutable, inout). Which is tedious (and a symptom of a missing
language feature IMO), but not exactly complex.
More information about the Digitalmars-d
mailing list