In which Michael does uncomfortable things with ClojureScript

I decided last night that I should force ClojureScript and Ember to get to know each other.

I found it amusing, and pretty fun to set up, so I thought I’d share.

Being fairly new to ClojureScript, I’m sure this is lacking in idioms. On the other hand, there is a lot of doing things in a very not-clojureish way to support Ember’s expectations.

I’d love to devise clever and fiendish ways of making Ember bend to the will of ClojureScript’s immutable datatypes and functional paradigms.

You’ll note that this goes back to the Bad Old Days of creating a top-level Application object, and manually attaching routes and components to it, and then setting up templates in script tags.

I’m hoping to come up with a basic Resolver that maps classes to ClojureScript namespaces, and I’d really love to come up with a way of updating Ember objects in an idiomatic (to Clojure) way that still triggers all the same stuff that Ember.set does.

I’d also like to find a way to write .hbs files and have them be compiled by the toolchain, and not write them in script tags.

While recognizing that this effort single-handedly defeats the purposes of both Ember and ClojureScript–and that it has no practical value beyond learning and fun–I fully expect to spend a goodly number of nights and weekends on it.

Here’s the .cljs file with the whole (very basic) ember app in it.

Here is the HTML file it renders to, which includes the templates:


Been hearing great things about Clojure so it’s on my radar… I’d love to hear how it ended up working for ya and if you did a write-up, i’d be on it… real fast.

I’ll absolutely write something up once I progress a little further on it. For the moment, the two files I linked to above is pretty much the entire project.

hi man! Have you done some more progress with this? How i can contact you?

My hope is that #Ember3 would be fully compatible with immutable paradigms, because it allows for a really amazing dev experience, makes implementing undo/redo functionality a lot more straightforward; I’m a big fan of the snapshot-ability. I think there’s some hope with ember-cerebral: Cerebral is a central state manager like Redux. UPD:This thread ultimately led up to the creation for ember-cerebral: Is Hot Reloading like Redux in Ember available