Status of Array extras in ECMA 4
Lars T Hansen
lth at acm.org
Sat Sep 1 11:24:22 PDT 2007
On 9/1/07, David Golightly <davigoli at gmail.com> wrote:
> (indexOf, lastIndexOf, forEach, map, filter, every, some) in ECMAScript 4.
> functional-style flexibility these methods offer, and have incorporated
> implementations of them into my everyday JS toolkit. (See:
> if you're not familiar with the Array extras.)
> However, according to the current ECMAScript 4 specification, these methods
> appear to be missing from Array.prototype:
Please don't read that spec, it's seriously out of date. It really
needs to be removed.
> Given the significant performance boost from moving this sort of iteration
> into machine code from interpreted code,
I don't agree with that assertion at all (or, I don't agree that
ECMAScript implementations are necessarily "interpreted", most are
compiling to byte code now and some are compiling to native code).
And even so, the overhead of calling the user function and collecting
the results is likely to dominate the running time of these functions.
> I for one would greatly appreciate
> an official endorsement of these methods in ECMAScript 4. They certainly
> seem to fit within the spirit of the existing ECMAScript 3 native array
> methods (slice, splice, etc.) and have parallels in the String prototype
> (indexOf, lastIndexOf). Is there a reason not to include them in ECMA 4?
> If so, what might that be?
They are included in the language.
More information about the Es4-discuss