5 ms·
Author here. Happy to answer any questions/concerns.
by aria 13y ago
Author here. Happy to answer any questions/concerns.
- zackzackzack 13y agoDid the speedup of script execution have other costs? One would imagine that using Clojurescript would incur some other costs somewhere. This feels like a free lunch somehow.
- aria 13y agoClojureScript generates a little more ephemeral garbage than native JavaScript and the Clojure data structures are slower, but in reality, the bottlenecks tend to be things which cross the DOM barrier and macros can make those bits much more efficiently. So it's not a free lunch, but it's very very cheap and tasty.
- bjourne 13y agoIt's incompatible with standard Javascript libraries, which is why you would use Dommy because you can't use jQuery. The ClojureScript compiler is also fairly slow (due to google closure compiler I think) so even with a running jvm it takes several seconds to compile small example files. To slow for me so I switched back to CoffeScript which is lightning fast.
- rads 13y ago"It's incompatible with standard Javascript libraries, which is why you would use Dommy because you can't use jQuery." Not true. (def $ js/jQuery) (.append ($ "body") "hello world") The reasons you'd use Dommy over jQuery are outlined in the original post.
- bjourne 13y agoNot quite. The following shows what doesn't work: (def $ js/jQuery) (.each ($ "body") (fn [idx, val] (.write js/document "In a lambda"))) The Google Closure Compiler munges names of functions so that any function declared in ClojureScript cannot be called from jQuery which means that no jQuery function that takes a callback can be used. And you really want to use GCC because without its dead code removal a simple helloworld.js file takes more than 700kb.
- swannodette 13y agoYou just need to compile your ClojureScript with the popular jQuery externs file.
- jwhitlark 13y agoYou can mark things so that their names aren't mudged via ^:export.
- dustingetz 13y agodoes Dommy provide a pure API on top of the DOM? (e.g., lens based) I don't immediately understand how one would make that performant given that the DOM is a mutable data structure. edit: WebFUI[1] is one clojurescript project trying to provide a pure interface for dom manipulation; there are others. [1] https://github.com/drcode/webfui https://github.com/drcode/webfui
- aria 13y agoNo. We're not trying to do something pure on top of the DOM. That isn't feasible for performant manipulation. Being functional is about more than just immutability. We use standard manipulation.
- laureny 13y ago> I don't immediately understand how one would make that performant given that the DOM is a mutable data structure. As a general rule, mutable API's tend to outperform immutable ones.
- jzelinskie 13y agoHow mature is ClojureScript these days? I remember people saying it and Clojure on Android was rough when I was exploring Clojure a while back. Does the compiler eliminate unused code from the final output?
- piranha 13y ago> How mature is ClojureScript these days? Seems to be pretty mature, there are apps in App Store written in it, and there are companies, using it for their front-end (i.e. Prismatic :)). > Does the compiler eliminate unused code from the final output? That's done by Google Closure Compiler in advanced mode.
- ConstantineXVI 13y agoI'm led to believe the issues with Clojure (and other JVM languages) on Android are due to Dalvik not being as friendly to other languages as the Sun JVM. I don't blame Google, but it's unfortunate.
- jwhitlark 13y agoThere are actually games written in Clojure that run on Android quite well. A bit slow to start up, but not nearly as bad as I had expected. Take a look at https://play.google.com/store/apps/details?id=com.friendlyvillagers.ballz&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5mcmllbmRseXZpbGxhZ2Vycy5iYWxseiJd https://play.google.com/store/apps/details?id=com.friendlyvi... and check out their development blog. EDIT: The guy who did NightWeb talks about Clojure on Android here: http://nightweb.net/blog/clojure-on-android.html http://nightweb.net/blog/clojure-on-android.html
- mtrimpe 13y agoWould it be possible to (document how to) replace jQuery in Backbone apps with Dommy?
- deleted 13y ago[deleted]