draft proposal for Sum Types for D

Andrey Zherikov andrey.zherikov at gmail.com
Sat Dec 3 17:07:59 UTC 2022


On Tuesday, 29 November 2022 at 06:26:20 UTC, Walter Bright wrote:
> Go ahead, Make My Day! Destroy!
>
> https://github.com/WalterBright/DIPs/blob/sumtypes/DIPs/1NNN-(wgb).md

Actually why not to introduce optional type first and then base 
sumtype implementation on optional saying that 
`sumtype_obj.value` yields to optional of type 
`typeof(sumtype_obj.value)?`

Offtopic about strictly non-null pointers: what's about `int*! 
ptr` syntax? a pointer that can be null: `int*? ptr`. And the 
regular pointer (`int* ptr`) can be, for example, force-treated 
as `int*! ptr` or `int*? ptr` based on compiler option.


More information about the Digitalmars-d mailing list