Dmitry Soshnikov (2014-10-01T22:35:44.000Z)
On Wed, Oct 1, 2014 at 12:28 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

>
> Then thing is: if we'd like to use maps for such use-case, it brings us
> back to that inconvenient imperative style of assignments (even worse,
> since you have to repeat that `.set(...)` constantly):
>
> ```
> var requestData = new Map();
> requestData.set(Names.ID, id);
> requestData.set(Names.EMAIL, email);
> requestData.set('needsReload', id);
> ...
> ```
>
>
> Note that you can chain:
>
> ```js
> var requestData = new Map()
> .set(Names.ID, id)
> .set(Names.EMAIL, email)
> .set('needsReload', id);
> ```
>
> Not too bad, IMO.
>
>
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
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141001/2b2f1ff7/attachment.html>
forbes at lindesay.co.uk (2016-02-01T12:50:43.924Z)
> Note that you can chain:
>
> ```js
> var requestData = new Map()
> .set(Names.ID, id)
> .set(Names.EMAIL, email)
> .set('needsReload', id);
> ```
>
> Not too bad, IMO.

Not ideal either. Usually langs provide nice declarative syntax for such
things. E.g. we [have the same in the HACK language](http://docs.hhvm.com/manual/en/hack.collections.map.php), and use it well
everyday when need a map.

But this part is of course not for ES6, hope ES7-ish.