T.J. Crowder (2017-08-11T06:17:36.000Z)
On Thu, Aug 10, 2017 at 11:24 PM, Alexander Jones <alex at weej.com> wrote:
>
> As far as I'm concerned, "most data arrays" — at least the ones
> you're speaking about — should actually be `Map`s.

I see the point you're trying to make, but

1. I routinely want paging and other access by arbitrary index

2. I routinely want to change the order, which is expensive with Maps

3. I'm usually receiving these by deserializing JSON

Granted #3 could be solved by making the JSON even more verbose than it is
(`[["foo", {"id":"foo",..}],["bar",{"id": "bar", ...],...]`) and then
creating the Map from that temporary array of arays but...no. :-) Not least
because of the knock-on effects on the generating code. So I'd need a way
to create the Map from the array even if I *were* using Maps from then on
(such as my `Map.from`).

Arrays are great random-access, sortable, tranferrable format; and
highly-optimized on modern JavaScript engines. No need to change it. And if
I *did* change it, I'd still need a way to create the Map in the first
place from the obvious transfer format: An array.

-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170811/f84e4ad3/attachment.html>
tj.crowder at farsightsoftware.com (2017-08-11T09:28:50.688Z)
On Thu, Aug 10, 2017 at 11:24 PM, Alexander Jones <alex at weej.com> wrote:
>
> As far as I'm concerned, "most data arrays" — at least the ones
> you're speaking about — should actually be `Map`s.

I see the point you're trying to make, but

1. I routinely want paging and other access by arbitrary index

2. I routinely want to change the order, which is expensive with Maps

3. I'm usually receiving these by deserializing JSON

Granted #3 could be solved by making the JSON even more verbose than it is
(`[["foo", {"id":"foo",..}], ["bar",{"id": "bar", ...], ...]`) and then
creating the Map from that temporary array of arrays but...no. :-) Not least
because of the knock-on effects on the generating code. So I'd need a way
to create the Map from the array even if I *were* using Maps from then on
(such as my `Map.from`).

Arrays are a great random-access, sortable, tranferrable format; and
highly-optimized on modern JavaScript engines. No need to change it. And if
I *did* change it, I'd still need a way to create the Map in the first
place from the obvious transfer format: An array.

-- T.J. Crowder