Brendan Eich (2014-10-01T23:51:15.000Z)
forbes at lindesay.co.uk (2016-02-01T12:52:52.750Z)
> Usually langs provide nice declarative syntax for such things. We could definitely have Map and Set literals: ```js const map = {1 => "one", "two" => true, false => "three"}; const set = {<1, "two", false>}; ``` If you still buy Harmony of My Dreams, prefix `#` before `{` to get immutable value-type forms. I don't mind reusing `=>` in initialiser context where `:` would go, but perhaps someone sees a problem I don't. The Set literal hack of `{<` and `>}` seems necessary given object initialiser property assignment shorthand syntax (`{x, y}` for `{x:x, y:y}`). Some kind of hack is required, yet losing `{` and `}` as outermost bracketing characters for Set seems worse than any digraph or token-pair alternative.
forbes at lindesay.co.uk (2016-02-01T12:15:11.735Z)
Dmitry Soshnikov wrote: > Not ideal either. Usually langs provide nice declarative syntax for > such things. E.g. we have[1] the same in the HACK language, and use it > well everyday when need a map. > > But this part is of course not for ES6, hope ES7-ish. > > [1] http://docs.hhvm.com/manual/en/hack.collections.map.php We could definitely have Map and Set literals: ```js const map = {1 => "one", "two" => true, false => "three"}; const set = {<1, "two", false>}; ``` If you still buy Harmony of My Dreams, prefix `#` before `{` to get immutable value-type forms. I don't mind reusing `=>` in initialiser context where `:` would go, but perhaps someone sees a problem I don't. The Set literal hack of `{<` and `>}` seems necessary given object initialiser property assignment shorthand syntax (`{x, y}` for `{x:x, y:y}`). Some kind of hack is required, yet losing `{` and `}` as outermost bracketing characters for Set seems worse than any digraph or token-pair alternative.