First Draft: Nominal Sum Types via `enum union` and `switch` Expressions
DanielG
simpletangent at gmail.com
Tue Sep 15 11:10:39 UTC 2026
Mostly on-board with this, with some minor quibbles:
- Purely aesthetic, but: why () at the end of cases, even with no
payload? Required for easier parsing or something?
- I still don't understand the appeal of bare type variants, but
I guess the D community loves them 🤷♂️. Is there some language I
don't know about that mixes these two concepts so directly? I
don't mean languages that have sum types AND type unions (eg
Scala 3) - but some language where they are mixed together, as in
your DIP here?
I wish we could just start with a very simple, conventional,
no-frills sumtype (named values + optional tupled arguments) and
then expand from there in the future. Isn't that what Swift has
today? That's *all* F# has or will ever have, and it's incredibly
powerful even in that simple form.
At any rate, your DIP's got the minimal feature set I want, for
my simple needs. Good luck!
More information about the dip.development
mailing list