On 2011/06/27 15:09:23, zundel wrote:
On 2011/06/08 23:26:58, cromwellian wrote:
Can you help me understand what the hoist fucntions are about?
Normally, virtual methods are declared inline, e.g.
function Foo() {}
_ = Foo.prototype = new ...
_.myMethod = function myMethod(a,b) { code }
function bar() {}
_ = Bar.prototype = new ...
_.yourMethod = function yourMethod(a,b) { identical Code }
Since yourMethod and myMethod have the same body, we want to share them,
but they are not in the global scope (top level function). Hoisting
basically takes one of the functions (say, myMethod) and moves it to a
top level function:
function myMethod(a,b) { ... }
Then the prototype setup code changes to look like this:
_ = Foo.prototype = ...
_.myMethod = myMethod; // reference to global hoisted version
_ = Bar.prototype = ...
_.yourMethod = myMethod; // reference to same global hoisted version
from Foo
http://gwt-code-reviews.appspot.com/1454806/
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors