sumtype 0.3.0
Paul Backus
snarwin at gmail.com
Tue May 8 21:37:33 UTC 2018
On Tuesday, 8 May 2018 at 06:33:38 UTC, TheGag96 wrote:
> Wow.. without comments and unittests, the implementation is
> only 116 lines. Awesome job. Even now I still find it
> incredible what D can do. Is Algebraic in the standard library
> really that bad? And if so, why aren't implementations like
> this being accepted?
Thanks!
Algebraic isn't terrible, but it has one significant design flaw,
which is that it shares its implementation with Variant. Variant
doesn't have a fixed list of allowed types, so it requires a much
more complex implementation than just a union and an integer tag.
By sharing that implementation, Algebraic inherits all the costs
of its complexity without getting any of the benefits.
I've never contributed to Phobos, so someone with more experience
may have better insight here, but my guess is that changing
Algebraic at this point would break too much code to be worth the
trouble. Perhaps when sumtype is more mature, though, a case
could be made for including it in a separate module.
More information about the Digitalmars-d-announce
mailing list