In short, yes, if you stick to gClosure, advanced compilation will
work fine.  Closure advanced compilation is an optimizing compilation
that minifies names and removes dead (unused, uncalled) code.  Trying
to use jQuery without special effort will result in calls to jQuery
being unaddressable.  There is a nice writeup on including external
javascript with ClojureScript and the Closure compiler at [1].  Also,
jayq has an externs file for advanced compilation with jQuery 1.7 at
[2].

[1] http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
[2] https://github.com/ibdknox/jayq/blob/master/resources/externs/jquery.js

On Sun, Feb 5, 2012 at 11:39 AM, Thomas Heller <th.hel...@gmail.com> wrote:
> Hey,
>
> I'm starting to get the hang of Clojure(Script) and I'm really enjoying it.
> I'd love to use it for a project but I have one major concern: How reliable
> is {:optimizations :advanced}?
>
> Advanced Compilation basically wins the whole argument for clojurescript but
> I managed to break it on a very simple project. I assume it broke because I
> tried to use jQuery and didnt stick to the closure library. The only reason
> I wanted to jQuery is because I'm very familiar with it (and javascript
> itself for that matter) and basically know nothing about closure, but I did
> some (rtfm closure) and managed to get it working without jQuery. Turns out
> you really dont need it.
>
> So is it a fair assumption that as long as I stick to Closure Library + any
> ClojureScript itself I'm good on the :advanced part? I'm not interested in
> node.js as a :target, only the Browser. Falling back to {:optimizations
> :simple} really is not an option since the resulting javascript is way too
> big.
>
> Cheers,
> /thomas
>
> PS:
>
> My Experiments with jQuery:
> http://www.zilence.net/cljs/index-dev.html
> http://www.zilence.net/cljs/index-simple.html
> http://www.zilence.net/cljs/index-advanced.html
> https://github.com/thheller/cljs-experiments/blob/master/src-jquery/jqtest/app.cljs
>
> The App is pointless and only tested in Chrome (firefox/ie dont like
> input[type='range']) but it should update the the input when you move the
> slider and update the slider when you change the input. dev/simple work
> fine, advanced breaks with some undebuggable error. I assume because the
> compiler optimized something away.
>
> The Closure Version:
> http://www.zilence.net/cljs/index-closure-advanced.html
> https://github.com/thheller/cljs-experiments/blob/master/src-closure/ctest/app.cljs
>
> Basically the same amount of code, so no reason to use jQuery. But I'd still
> be interested to know why the jQuery version breaks.
>
> --
> 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

-- 
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