W3C home > Mailing lists > Public > public-script-coord@w3.org > April to June 2011

Re: whether [Callback=FunctionOnly] should be the default

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 28 Jun 2011 23:01:39 +0000 (UTC)
To: Boris Zbarsky <bzbarsky@MIT.EDU>
Cc: public-script-coord@w3.org
Message-ID: <Pine.LNX.4.64.1106282258511.20871@ps20323.dreamhostps.com>
On Tue, 28 Jun 2011, Boris Zbarsky wrote:
> 
> This pattern doesn't work well if what you want is to encapsulate state 
> including a given prototype chain and the like.  Sure, you can hack it 
> all with a closure because you can just close over everything you care 
> about and delegate things, but in some cases having an actual object 
> which ends up as the this of the callback and has a useful prototype 
> chain and whatnot is just much clearer.

This is probably just a personal preference thing. Personally I've never 
really found the prototype mechanism in JS to be especially intuitive and 
so the idea of using it in this way frightens me. :-)

One big advantage of FunctionOnly is that the code that uses the API 
cannot do complicated things such as what you describe, thus making code 
that uses the API simpler to understand, IMHO.

But that's rather subjective, I'll be the first to admit.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 28 June 2011 23:02:12 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:03 UTC