Map literal

Tab Atkins Jr. jackalmage at
Wed Oct 28 01:08:55 UTC 2015

On Wed, Oct 28, 2015 at 8:36 AM, Alexander Jones <alex at> wrote:
> I agree this is pretty important. Using actual maps really frees up a lot of
> complexity, but the syntax is cumbersome to say the least.
> Whatever the decided syntax, bare words as string keys is a really bad idea
> IMO. The key syntax should be parsed as an expression, like the values are,
> and like they are in basically every other language.
> Another outstanding issue is that we might want the syntax for
> `Immutable.Map`, or `WeakMap`, or `MapTwoPointOh` that improves deficiency
> $x, $y and $z. I'd say introducing a special syntax for `Map` right now is
> not ideal.

Currently, the "extensible literal syntax" for this isn't that bad:

const bar = 43;
const map = Immutable.Map([["foo", 42], [bar, 44]]);

It's a little more verbose because the entries have to be surrounded
by [], but hey.


More information about the es-discuss mailing list