- From: Ian Hickson <ian@hixie.ch>
- Date: Tue, 31 May 2011 21:29:44 +0000 (UTC)
- To: Simon Pieters <simonp@opera.com>
- Cc: Adrian Bateman <adrianba@microsoft.com>, Jonas Sicking <jonas@sicking.cc>, Aryeh Gregor <Simetrical+w3c@gmail.com>, "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>
On Tue, 31 May 2011, Simon Pieters wrote:
> On Tue, 31 May 2011 22:03:49 +0200, Ian Hickson <ian@hixie.ch> wrote:
> >
> > > We think this makes the design more future-proof because otherwise
> > > and new information required prior to establishing the connection
> > > will need to be added to the constructor arguments.
> >
> > We can easily overload the constructor,
>
> Overloading the constructor would work but having several orthogonal
> optional arguments is bad API design, where you'd end up with something
> like
>
> new WebSocket(url, null, null, null, null, 'foobar');
>
> instead of
>
> new WebSocket(url, {foo:'foobar'});
Hard to say without knowing what the future extensions are going to be.
> > or delay the connection to the next time the event loop spins,
> > allowing any additional needed information to be provided after the
> > constructor has been called.
>
> It seems bad to delay the connection just because the API designers
> didn't think about future additions.
We're talking on the order of nanoseconds here, I don't see why that's a
problem.
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 31 May 2011 21:30:17 UTC