Closed
Description
I've been working with code that uses "hash map" style JS objects, and the ReScript syntax for declaring them can be tedious. (Or rather, the lack of syntax to declare them is tedious.)
Consider this JS:
const data = {
a: foo,
b: bar,
c: baz,
};
Compared with this ReScript:
let data = Js.Dict.fromArray([
("a", foo),
("b", bar),
("c", baz),
])
That's a lot of extra parentheses and brackets to express the same thing. When you inline it somewhere (such as inside a function argument), then it's even more noisy and less readable.
My suggestion is to include a dedicated syntax similar to Js.t
objects. Maybe something like this:
@dict
let data = {
"a": foo,
"b": bar,
"c": baz,
}
Would this make sense to add?