[whatwg] DOMTokenList methods would be more useful with a space separated token list
Ian Hickson
ian at hixie.ch
Wed May 2 16:17:19 PDT 2012
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. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list