RFC: std.sumtype (adding sumtype to Phobos)

Paul Backus snarwin at gmail.com
Wed Nov 25 15:37:42 UTC 2020


On Wednesday, 25 November 2020 at 15:07:38 UTC, SHOO wrote:
>
> I think SumType is better to be included in std.typecons. 
> Rather than a new module, I think it is more appropriate to 
> treat it in the same breath as Tuple, Unique, etc.

I considered that as an option. The reasons I decided against it 
were:

1. std.typecons is one of the largest modules in Phobos, at over 
9000 lines. One Phobos maintainer I spoke to mentioned that they 
were already considering splitting it up into separate modules 
like std.tuple, std.nullable, std.unique, etc. Given all that, 
adding sumtype's 2500 lines to the pile didn't seem like a great 
idea.

2. sumtype's unittest suite is compatible with BetterC, but 
std.typecons' is not, so merging the two modules would result in 
worse test coverage (which could lead to regressions in sumtype's 
BetterC compatibility in the future).

3. sumtype's documentation makes extensive use of 
cross-references, and is much easier to follow when it's on its 
own dedicated page rather than mixed up with a whole bunch of 
unrelated stuff.


More information about the Digitalmars-d mailing list