W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2013

Re: [whatwg] [Notifications] Constructor should not have side effects

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 29 Jan 2013 20:32:19 +0000 (UTC)
To: Elliott Sprehn <esprehn@gmail.com>
Message-ID: <Pine.LNX.4.64.1301292028370.6293@ps20323.dreamhostps.com>
Cc: WHATWG <whatwg@whatwg.org>, Charles McCathie Nevile <chaals@yandex-team.ru>, olli@pettay.fi, Jake Archibald <jaffathecake@gmail.com>, Ryosuke Niwa <rniwa@apple.com>
On Tue, 29 Jan 2013, Elliott Sprehn wrote:
> On Tue, Jan 29, 2013 at 3:02 PM, Ryosuke Niwa <rniwa@apple.com> wrote:
> >
> > ... Is that even a valid use case? It seems dubious to instantiate a 
> > class named "request" and then not send a request.
>
> You can't go down that line of thinking because it doesn't generalize. 
> For instance why would I instantiate a class named "node" without 
> putting it into the tree?

There are all kinds of reasons why you may do this. Hence, we support it.

Reasoning by use case definitely generalises -- it's how we design 
everything around here. :-)


> If we followed that logic then new HTMLDivElement should append itself 
> into the document by default.

A more apt example would be the way <audio>, when constructed with a URL, 
immediately starts loading it.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 29 January 2013 20:32:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:12 GMT