2 ms·
How do you distinguish a tuple with both positional and named fields from a tuple that has a record as a field Like how do you write the type of (1, {sum:2}) ?
by afiori 1y ago
How do you distinguish a tuple with both positional and named fields from a tuple that has a record as a field
Like how do you write the type of (1, {sum:2}) ? Is it different from (1 , sum :2)?
- munificent 1y agoThe syntax is a little funny for mostly historical reasons. The curly braces are only part of the record type syntax. There's no ambiguity there because curly braces aren't used for anything else in type annotations (well, except for named parameters inside a function type's parameter list, but that's a different part of the grammar).
- afiori 1y agoso my examples would be (1, (sum:2)) and (1, sum:2)?
- munificent 1y agoYes, exactly.