Array Generics and null

Mike Shaver mike.shaver at gmail.com
Sat Mar 22 22:18:53 PDT 2008


On Sat, Mar 22, 2008 at 4:32 PM, Dean Edwards <dean at edwards.name> wrote:
>  Dean Edwards wrote:
>   > I think that the problem is that Array generics were added later.
>   >
>   > From bugzilla:
>   >> Array.generic(t, ...) is *intended* to be equivalent to
>   >> Array.prototype.generic.call(t,  ...).
>   >
>   > If generics were considered when first designing the language then the
>   > above statement would have been the other way round.
>   >
>   > e.g.
>   >
>   > Array.prototype.forEach = function(block, context) {
>   >   Array.forEach(this, block, context);
>   > }
>   >

I don't see how that helps, unless you expect A.p.g.c(null, f) to
differ from A.g(null, f) -- the former will need to make a |this| from
null, giving the window object in browser embeddings.  I don't believe
that they should so differ -- do you?

Mike



More information about the Es4-discuss mailing list