It looks like it actually does do dead code removal by assuming that
if functions aren't called and aren't manually specified as in use by
other code by the author, it can safely eliminate it. By making that
assumption they put the Closure Compiler somewhere near the GWT
compiler.
Regardless, I'm looking forward to diving into their code when I get
some time on my hands. I assume the (Google part of the) GWT team has
already had access to this code for some time, no?
On Nov 5, 6:44 pm, Sripathi Krishnan <
sripathi.krish...@gmail.com>
wrote:
> They both have goals that overlap (generating optimized javascript code),
> but different paths to achieve that goal.
>
> The most obvious difference is that GWT is a java to javascript compiler;
> whereas closure compiler is a poor js to optimized js compiler.
>
> CC has various levels of optimization; but even at its highest level it
> cannot beat GWTC. GWTC is a "closed world" or "monolithic" compiler. It can
> analyze the entire source code of your application before making decisions.
> So when GWTC deletes a method, it is 100% sure that method is not being
> used. CC cannot make this guarantee - because you could invoke a js function
> from a html file (embedded script tag, javascript:method() url etc.), - and
> CC has no way of knowing that. In short - GWTC can guarantee equivalence
> between input and output; CC cannot do so in advanced modes.
>
> The use cases for Closure Compiler are also different. You'd like to use CC
> on a legacy application that can't be converted to GWT (or you don't want
> to). For a new project, however, it makes sense to go the GWT route.
>
> --Sri
>
> 2009/11/5 davidroe <
roe.da...@gmail.com>