W3C home > Mailing lists > Public > whatwg@whatwg.org > May 2012

[whatwg] DOMTokenList methods would be more useful with a space separated token list

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 2 May 2012 23:17:19 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1205022309390.19700@ps20323.dreamhostps.com>
On Wed, 2 May 2012, Rick Waldron wrote:
> 
> JS APIs like this should always return the object (constructed instance 
> or not) and therefore chain implicitly.

I understand that this is mostly a matter of taste in API design, but IMHO 
that's an anti-pattern. It encourages poor style; it discourages 
functional programming patterns, instead favouring state mutation 
patterns; it makes APIs harder to extend; it makes APIs that do have 
useful return values inconsistent with other APIs; it is, in fact, a 
layering violation: it attempts to shoehorn what should be a language 
design feature into the API layer.

But I'll leave it up to the DOM guys to decide what to do for that 
interface. :-)

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Wednesday, 2 May 2012 16:17:19 GMT

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