Somewhat of a radical idea this morning, and likely one that has already been discussed and rejected before, but I couldn't find the discussions: since records are basically tuples with named fields, why not use the tuple syntax (with parentheses) for records, which would free up the curly bracket syntax for Dict and Set literals?
For example:
bart = (first_name: "Bart", age: 10)
dict = {"one": 1, "pi": 3.14}
set = {1, 3, 5, 7}
For empty Dict or Set, we could do like Python and assume {} is an empty Dict (since Dict is more frequently used than Set), or we could have some syntax like {:} for an empty Dict.
empty_record = ()
empty_dict = {}
empty_set = Set.empty()
# or
empty_record = ()
empty_dict = {:}
empty_set = {}
Pros:
Dict and Set.Cons:
roc fmt? And perhaps the current record syntax could still be supported for a while, I don't think there's any ambiguity, except for {} (unit), which would become ().I'm curious about making list and record literals be flexible the way string an number literals are
so maybe you could write dictionaries as like { SomeTag: "blah", Another: "etc" }
and sets using square brackets
and then it would work for any userspace-defined custom collection type too
Oooh, interesting, I hadn't considered that
So {one: 1, pi: 3.14} could either be a Dict or a record. I suppose it would default to record?
But {"one": 1, "pi": 3.14} would have to be a Dict, right?
I think it would be { one: 1 } is a record and { (one): 1 } would be custom
and then you can put whatever expr you want in there to evaluate the key
and you don't need the parens for other literals like 1 and "foo"
I'm not sure I understand. Would this work?
x = "one"
{ (x): 1, "two": 2 }
that's the idea!
it's a massive change for users
It's non-breaking though right? like we aren't removing the helpers are we? this is a new literal syntax
Nvm, I guess it is for {} and () have new meaning -- and the records look totally different :sweat_smile:
Last updated: Sep 24 2026 at 15:59 UTC