Re:Embedded Swift on the Raspberry Pi Pico
by Gibbon1 on Wednesday March 06, 2024 @04:13PM
(#39621543)
I strongly believe (waves hands while making incoherent small brained primate noises) that discriminated union types would be fabo for C as well.
Example why it would be sweet. Compiler could spit out a warning if it's not sure the correct union type is being used. Like if the pet union has dog and cat. Cat has respawn set initially to 9. Dog doesn't have respawn. If you try to set respawn without checking if it's a cat compiler whines about it.
The day C# gets discriminated union types and true exhaustive pattern matching is the day I’ll have to think long and hard about how much more time I want to put into working with my beloved F#.