Array Generics and null

Dean Edwards dean at edwards.name
Sat Mar 22 23:44:08 PDT 2008


Mike Shaver wrote:
> Dean Edwards wrote:
>>> 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?
> 

I'd prefer Array.forEach(null) to do nothing, just like for (var i in
null) does nothing. I'm prepared to be convinced otherwise. :-)

-dean



More information about the Es4-discuss mailing list