Uh oh!
There was an error while loading. Please reload this page.
feat: named unions - #4038
Conversation
vanillajonathan
commented
Jan 2, 2024
Seems related to #2930. This is cool but the syntax is quite jarring. I would have expected something much simpler and more akin to what is available in other languages. |
max-sixty
commented
Jan 2, 2024
In a way these are similar to Enums, since they're Sum Types. Though I don't see the immediate need to build that feature now. (and because we're early in this feature, and it is mostly internal, we shouldn't prioritize aesthetics highly) One small change that might make it look better is to put the binary operators at the beginning of the next line. The standards for this changed to this in python a few years ago, which made pipelines of binary operators easier to read. |
aljazerzen
commented
Jan 3, 2024
Like this? We don't allow leading But again, these are just aesthetics. |
max-sixty
commented
Jan 3, 2024
Almost, but there's no leading type Status = (
- || Paid = ()+ Paid = ()
|| Unpaid = float
|| {reason = text, cancelled_at = timestamp}
) |
Support for parsing and codegen of:
As we don't have any code for interaction with this, this does not change the behavior in any way, so I'm not adding a changelog.