sumtypes for D

deadalnix deadalnix at gmail.com
Tue Nov 29 12:39:35 UTC 2022


On Tuesday, 29 November 2022 at 02:53:27 UTC, Adam D Ruppe wrote:
> On Tuesday, 29 November 2022 at 02:33:21 UTC, deadalnix wrote:
>> I'm literally building a sum type
>
> Curious, what did you find lacking in std.sumtype?
>
> Same question to Walter.
>
> (btw I've never used it myself but this seems an obvious 
> question that needs to be answered by anyone doing their own 
> implementation, in or out of the language)

Good question. They didn't work in my case mainly for 2 reasons:
  - The above mentioned problem with qualifiers. `const SumType(A, 
B)` is somehow completely unrelated to `SumType(const A, const 
B)` which is not workable in practice.
  - I needed a set of implicit conversions between the elements 
when the sum type is used is certain ways, and as far a I can 
tell, there is no way to extend std.sumtype to achieve this kind 
of things.


More information about the Digitalmars-d mailing list