On Mar 11, 8:56 pm, Kelly Norton <[email protected]> wrote:
> I was typing up an email and then Joel's response arrived covering much of
> what I was typing, so I'll just add to his points:
> The first thing I was going to mention is that, as I understand it, pyjamas
> loads modules by injecting a script tag and then running a timer to
> determine when the module has loaded.

 yeh.

> I'm curious why it doesn't just add a
> callback to the module script to avoid the timer?

 because in the way i've done it, several modules can be injected
simultaneously.

 i have a compile-time post-processing step which works out, from all
of the imports inside modules which did import etc., what the modules
are which have zero dependencies (sys, Window, DOM, etc.) and fire
those off simultaneously.

then, the timer loop waits for all of those to load, and can then move
onto the second level. all of which will have the first level, which
are now loaded, as dependencies.

one of the plans i have is to make sure that all scripts are loaded,
but the "module init" functions are _not_ called.  when the timer
detects that all of the modules that are required by the app are
loaded, the main app module's init is called, which will have import
statements, which will result in a depth-based set of calls to the
init routines of all of the modules that were imported.

in this way, the problem of async dynamic module loading is entirely
avoided.  messily, but avoided :)

> The second thing is a more general question. GWT's code splitting is largely
> about doing analysis to determine code dependencies between the various
> split points. It sounds like pyjamas simplifies split points by just making
> them modules,

 yes.

> but does it do any dead code elimination or does it just
> translate the entire module to javascript?

 *sigh* nooo, can't do that - has to be the entire module, because
people could in future do "exec" or "eval" on code-fragments at
runtime.  which, now that i think of it, is completely broken! :)
well, i say broken - theoretically an implementation of exec or eval
could call to a web service which dynamically runs the pyjs compiler
on the code-fragment EUGH :)

l.

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to