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:

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.

/be
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to