Open matu3ba opened 1 year ago
Tuples are nice, they would be like strings except each element can be any value. I think it would be a nice addition but it's not a big priority. Currently, you can create a list with an initial capacity using arrayFill
, but it's still mutable.
I'd like to know what people like using tuples for to further the case of supporting them. One use I can think of is using them as keys to a map. Another might be slicing like string slices.
If we did have them, I think the initializer might look like tuple = #[ 1, 2, 3, 'foo']
.
Tuples are usually used in embedded and/or tree-like structures a lot. Otherwise they are perceived as a poor man's "performance" solution to lack of immutability in various parts of the language (Cyber has only immutable strings, but lacks any other immutability).
con:
pro
better than Python (tuples not allowed as function arguments)C structs compat.