A few weeks ago I spent some time porting https://github.com/stuartsierra/component to ClojureScript. The results are here:
github: https://github.com/quile/component-cljs
Clojars: [quile/component "0.2.2"]
My motivation is pretty straightforward: I am keen to make node.js a really pleasant experience for cljs development. I've done a large amount of vanilla node.js dev, and the dependency-injection problem always reared its ugly head at inopportune moments, so making https://github.com/stuartsierra/component work in cljs seemed like a good idea. And it was! It works like a charm.
This port is fairly soft: there are still some failing tests (commented out) due to the differences in exception-handling between clj and cljs. Also, I had to port the underlying "dependency" library too:
github: https://github.com/quile/dependency-cljs
The upshot of all of this is that it's now very easy to create nicely modular node.js apps in ClojureScript, with their dependencies injected correctly. Fun.
Cheers!
Kyle
Kyle
--
Note that posts from new members are moderated - please be patient with your first post.
---
You received this message because you are subscribed to the Google Groups "ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojurescrip...@googlegroups.com.
To post to this group, send email to clojur...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.
I'll dig in next week. point me towards your failing tests and maybe I can try to lend a hand.
Glad to help out - really we owe Stuart for making it all possible. I'm just stoked to have this facility in node.js now - makes node dev a whole lot more fun.
There are a couple of test failures in the dependency project
https://github.com/quile/dependency-cljs
but on deeper inspection I noticed a couple of things:
1) Tests fail in the same manner (but with slightly different results) in clojure 1.6
2) The tests are regarding topological sorting, and there are actually many valid topological sorts of the same graph, but the tests only check for a specific one - so IMHO the code is producing a valid sort, but the tests are failing because it's not the expected sort.
Also, in the component-cljs project, a lot of the exception-related code doesn't port well because Javascript handles exceptions so differently. This is where the chief problems are on the cljs side, and those tests are marked to only compile in Clojure, not ClojureScript for the time being. If you put them back in, you'll get the failures.
Cheers!
Kyle