draft proposal for Sum Types for D

Walter Bright newshound2 at digitalmars.com
Fri Dec 2 01:40:22 UTC 2022


On 11/29/2022 1:37 AM, Paulo Pinto wrote:
> 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
> 
> What if I game the compiler changing the declaration order?
> 
> sumtype Pointer
> {
>      int* Ptr,
>      Null,
> }

That shouldn't make any difference.

> or if I have multiple pointer based cases,

For multiple non-null pointers:

sumtype Pointer { Null, int* Ptr }

sumtype TwoPointers { Pointer Ptr1, Pointer Ptr2 }


More information about the Digitalmars-d mailing list