Optional and NotNull version 0.5.0 - swift optional like and scala option like

Paul Backus snarwin at gmail.com
Wed Aug 22 22:49:52 UTC 2018


On Wednesday, 22 August 2018 at 22:11:05 UTC, aliak wrote:
> On Monday, 20 August 2018 at 19:52:53 UTC, jmh530 wrote:
>>
>> It's interesting that both sumtype and optional have match 
>> templates. Maybe scope to combine these projects?
>
> That'd be cool. Optional uses .match on a "some" or "none" 
> range, while SumType uses it on a union. So ideas on how to go 
> about it?

In theory, Optional(T) could be implemented as a wrapper around 
SumType!(T, None), which would let it reuse SumType's match 
method. I'm not sure if it'd be worth the effort to convert at 
this point, though.


More information about the Digitalmars-d-announce mailing list