(no title)
aledue
|
3 years ago
Are hare's tagged unions and pattern matching comparable to ADTs found in functional languages? I really miss them in C and would like a "better C" that offers them. Rust does, but of course it's a much bigger language.
turminal|3 years ago
There are sum types (tagged unions), but product types (tuples) were a late addition and we still don't have support for tuple unpacking or pattern matching on them.
Tuple unpacking is something that's been put off for very long but looks like it is going to finally happen soon. Pattern matching on types other than tagged unions hasn't been completely ruled out yet, but is also not guaranteed to happen.
ddevault|3 years ago
https://harelang.org/tutorials/introduction/#tagged-unions-i...
They are also covered in section 6.5.18 of the Hare specification:
https://harelang.org/specification.pdf
Would be curious to hear your thoughts on how they compare given your (presumed) background in functional programming.
erk__|3 years ago
aledue|3 years ago
> Would be curious to hear your thoughts on how they compare given your (presumed) background in functional programming.
I'm just a student with an interest in programming languages and very little knowledge and experience, so I don't think I'll be able to provide any significant insight ;)