W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2014

Re: map() annotation for iterables?

From: Jason Orendorff <jason.orendorff@gmail.com>
Date: Mon, 6 Oct 2014 13:31:54 -0500
Message-ID: <CAPh8+Zr-mZu31p_pySapBvx=8O=swx+pfaLu=U2nz8dcLvLa2A@mail.gmail.com>
To: Brendan Eich <brendan@secure.meer.net>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, Domenic Denicola <domenic@domenicdenicola.com>, "public-script-coord@w3.org" <public-script-coord@w3.org>
This would be wonderful. Ruby's Enumerable works this way. It's a
wonderful, useful feature.

It's doubtful whether we could add even an empty object to the
Array.prototype proto chain. Web compat. But I'm willing to review and
land a patch to do the experiment in Firefox Nightly. Any takers?

-j

On Sun, Oct 5, 2014 at 12:58 AM, Brendan Eich <brendan@secure.meer.net> wrote:
> Boris Zbarsky wrote:
>>
>> On 10/5/14, 1:04 AM, Brendan Eich wrote:
>>>
>>> Right, see https://www.w3.org/Bugs/Public/show_bug.cgi?id=26973#c3.
>>
>>
>> Right, I'm not talking about for-of but directly doing map/filter
>> operations on iterables.
>
>
> Agree we want both. Provided the right class instance (Map for MapIterator)
> is created, the iterable prototype methods seem just as generic. This really
> wants something hard (not impossible, just undertested) to add:
> Iterable.prototype or an unnamed %IterablePrototype% above Array.prototype,
> Map.prototype, Set.prototype, etc. Someone please raise on es-discuss, if
> this seems right.
>
> /be
>
Received on Monday, 6 October 2014 18:32:24 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:23 UTC