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

Glenn Maynard glenn at zewt.org
Tue Jan 29 07:44:45 PST 2013

On Tue, Jan 29, 2013 at 7:36 AM, Charles McCathie Nevile <
chaals at yandex-team.ru> wrote:

> Really? This doesn't seem like a good idea, so I'd be interested to know
> why. Is there an explanation laid out somewhere?

Just to ask from another perspective: why doesn't it seem like a good idea?

Having objects that begin their job when constructed simply avoids an extra
step for the user (telling it to start), and reduces the number of possible
states (eg. eliminating the UNSENT state), which generally simplifies
things.  Supporting reuse of objects is generally not a useful optimization
(in my experience), so not supporting it also simplifies things a bit.
 Reducing the number of different-but-equivalent ways of doing the same
thing is also generally good API design.

Glenn Maynard

More information about the whatwg mailing list