Re: map() annotation for iterables?

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