Static Array and String Generics and Host Objects (ATTN IE Team)

Allen Wirfs-Brock Allen.Wirfs-Brock at
Mon Dec 7 12:42:04 PST 2009

The "static generic" versions of these functions were discussed during the development of ES5 but nobody advocated strongly for their inclusions. 

My personal opinion is that having what appears to be duplicate functions on both Array and Array.prototype is a likely source of confusion for unsophisticated programmers and largely unnecessary for more sophisticated programmers who know how to use call.

The inadmissibly of the array functions for host object is explicitly allowed for by the ES3&5 specifications. However, I will make sure that those responsible for the IE DOM are aware of the issue.


-----Original Message-----
From: es-discuss-bounces at [mailto:es-discuss-bounces at] On Behalf Of Maciej Stachowiak
Sent: Monday, December 07, 2009 11:40 AM
To: Garrett Smith
Cc: public-script-coord at; es-discuss
Subject: Re: Static Array and String Generics and Host Objects (ATTN IE Team)

On Dec 4, 2009, at 1:48 PM, Garrett Smith wrote:

> Static Array and String Generics was an ES4 proposal[0], and is
> implemented in Mozilla JavaScript 1.6[1].
> What are the plans for including Array and String Generics in future
> revision of ES?

I'm curious about this as well. We've had some requests to add these  
to JavaScriptCore. I'd like to know if they were explicitly rejected  
from standard ECMAScript, or might be considered for further  
ECMAScript editions.

Would the ECMAScript standards community advise that we implement  
these in WebKit or hold off?

  - Maciej

> There is no new syntax needed to support this. Scripts today can be
> compatible by adding:-
> if(!Array.slice) {
>    Array.slice= function( arrayLike, start, end ) {
>        return arrayLike,
>          start||0, end||arrayLike.length);
>    };
> }
> However, there is a remaining problem there: No guaranteed behavior
> with Host object and Errors in IE. Example:
>  javascript:alert(   [] document.childNodes ) );
> Error in IE8: "JScript Object Expected".
> It would be best for IE to use Native object for Host objects. That
> way, unwanted surprises like the above error should be done away with.
> Array and String generics are useful for non-array objects.
> The outcome of [] should be determinable. It is up to
> public-script coord to define what happens when a Host object is used
> in an Array.
> Brendan's 7-month-old message[2] asking for IE to comment on Array
> generics with host object, should be proactively addressed.
> There are open bugs for Webkit[3] and Chrome[4] for implementing Array
> generics At the time that I  filed the webkit bug, I was under the
> impression that it was on its way to being standardized. I do not see
> that happening.
> Proposals:
> 1) ES Harmony standardize Static Array and String generics
> 2) The IE team use Native object for Host object collection
> [0]
> [1] 
> #Working_with_Array-like_objects
> [2]
> [3]
> [4]
> _______________________________________________
> es-discuss mailing list
> es-discuss at

es-discuss mailing list
es-discuss at

More information about the es-discuss mailing list