draft proposal for Sum Types for D
Walter Bright
newshound2 at digitalmars.com
Wed Nov 30 09:33:54 UTC 2022
On 11/29/2022 12:37 PM, Per Nordlöw wrote:
> ```d
> sumtype Result
> {
> Error,
> int Value
> }
> ```
>
> , is
>
> ```d
> Result res;
> res = 25;
> ```
>
> supposed to be supported aswell?
At the moment, no, should be:
res.Value = 25;
> If so, why not
I'd reframe that as why do it?
On a pragmatic note, there may be multiple matches for an int in the sumtype.
More information about the Digitalmars-d
mailing list