draft proposal for Sum Types for D
Quirin Schroll
qs.il.paperinik at gmail.com
Wed Nov 30 14:33:51 UTC 2022
On Tuesday, 29 November 2022 at 14:46:35 UTC, Timon Gehr wrote:
> On 11/29/22 07:26, Walter Bright wrote:
>> Go ahead, Make My Day! Destroy!
>>
>> https://github.com/WalterBright/DIPs/blob/sumtypes/DIPs/1NNN-(wgb).md
>
>
> Maybe consider changing the syntax to something like:
>
> sumtype ST{
> a;
> int* b;
> }
>
> The reason is that with comma-separated values, metaprogramming
> is hobbled.
>
> [snip]
>
> Similar for `static foreach`. The fact that this does not work
> for `enum`s is among the most annoying limitations of `enum`s.
I wanted to write something like this in my post, but it really
didn’t fit. As for `enum`, can’t semicolon syntax just be added?
Can’t we just both allow `enum X { A; B; }` and `enum { A, B }`?
(We don’t need to deprecate the comma syntax, it works fine
except when it’s a hindrance. It’s not evil.)
More information about the Digitalmars-d
mailing list