quint icon indicating copy to clipboard operation
quint copied to clipboard

Inconsistency between constructor for maps and records

Open shonfeder opened this issue 1 year ago • 1 comments

There's a (seemingly) unnecessary inconsistency in our constructors for records and maps:

>>> Rec("beep", 2, "boop", 3)
{ beep: 2, boop: 3 }
>>> Map(("beep", 1), ("boop", 2))
Map("beep" -> 1, "boop" -> 2)

This isn't much trouble in practice, since people are likely to use the { sugar. However, I think it would be an improvement to make this unform.

shonfeder avatar Apr 13 '23 16:04 shonfeder

There is an important difference between Map and Rec. The arguments of Map should all have the same type, whereas Rec has other restrictions, namely, even-positioned arguments (counting from 0) are strings. We could use the Map-like syntax though.

konnov avatar Apr 13 '23 17:04 konnov