2012/10/16 David Nolen <dnolen.li...@gmail.com>

> None of the invocation optimizations make any sense for anything other
> that advanced optimization.


But the invokations in javascript output work even when not using google
closure at all, e.g. the REPL.


> They hard code static assumptions that might get invalidated in any
> compilation unit other than whole program.
>
> Partially agree: I would call those hard coded static assumptions an ABI
(e.g. the naming convention for fixed arity invokations, or the invokation
of a protocol fn) and compilation units would only work, when the APIs they
consume have a matching ABI (this is true even now, you wouldn't compile
parts of your project with different versions of clojurescript, would you?).


> We don't need to look at the whole program at once. Think about why we
> need declare and most Clojure programs avoid it if they can.
>
>
We need declare, because clojure features a single pass compiler, and
sometimes we want to code mutual recursion without letfn. The moral
equivalent for the MM dead code issue would be a compiler flag to turn off
multimethods, right?. Certainly doable. If you'd like me to implement that
flag before turning to more comprehensive optimization, I'll do it.

So yes, if we want to eliminate more dead code without having the user
manually turn off features, I think we do need to look at the whole
program, don't we?

Please also note: I'm not proposing to get rid of the single pass semantics
of clojure. Quite the opposite. After the analyzer is done with its single
pass and has unambigously resolved everything, optimization passes are free
to optimize, since the semantics are already established.


> I don't think we need any fancy compiler stuff to fix the two big dead
> code issues in the near term.
>
>
I agree that the unused read issue can be generically solved in the
emitter. For the one with unused toplevel vars like global-hierachy, I'm
not so sure, especially if we also want to solve the problem for libraries,
which arguably is a goal of clojurescript.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to