draft proposal for Sum Types for D
Paulo Pinto
pjmlp at progtools.org
Tue Nov 29 09:37:45 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
What if I game the compiler changing the declaration order?
sumtype Pointer
{
int* Ptr,
Null,
}
or if I have multiple pointer based cases,
sumtype Pointer
{
int* Ptr,
Null,
int* AnotherPtr,
}
or only the pointers,
sumtype Pointer
{
int* Ptr,
int* AnotherPtr,
}
From my point of view this should at very least be a compiler
error in @safe, or the compiler needs to be smart enough to
ensure there is at least a non-pointer case and it must be the
zero index one.
More information about the Digitalmars-d
mailing list