No syntax tuples. #1010
Replies: 1 comment 4 replies
-
It's not quite what Go does, they don't have tuples at all, just a syntax for returning more than one argument. You can't save all the values to one variables for example. It's not possible in Gleam today because it would be ambiguous. Is Additionally it would mean that we also need to use |
Beta Was this translation helpful? Give feedback.
-
One feature I discovered only when Louis told me about it was that case statements could have multuple values.
i.e.
I assume that under the hood this is handled as a tuple?
Could other parts of gleam handle multiple values like this, I don't see any reason why not.
For example
This would be a suggestion, instead of a short tuple syntax see #1005
Maybe that ship has sailed, but it seems consistent with case statements and has precedent in language like Go.
https://gobyexample.com/multiple-return-values
Beta Was this translation helpful? Give feedback.
All reactions