[whatwg] getElementsByClassName()

Ian Hickson ian at hixie.ch
Mon Oct 23 18:01:58 PDT 2006

On Tue, 24 Oct 2006, Joao Eiras wrote:
> Na , Ian Hickson <ian at hixie.ch> escreveu:
> > On Tue, 24 Oct 2006, Joao Eiras wrote:
> > > 
> > > The question is.. is there really the need for the array ? Most 
> > > bindings support variable arguments.
> > 
> > The initial proposal used varargs, but people pointed out that that 
> > made it difficult to call the method with an arbitrary number of 
> > arguments, which is why it now takes an array.
> Ok then, but there could be that option for both Java's and ecmascript's 
> bindings.

I agree that varargs seems like a good idea, but you and I seem to be the 
only ones who think that. :-(

As far as Java goes, I don't really have an opinion. For areas where 
interoperability isn't important, people implementing the APIs can take 
whatever liberties they want.

> Instantiating an array adds bloat to the code and inefficiency. So this 
> would be something to keep.

I really don't think that instantiating an array is something that's even 
remotely going to appear on the radar when you compare it to the rest of 
what the method is doing (crawling the entire DOM and creating a live 
NodeList that tracks DOM changes).

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list