Hello ClojureScripters,

I started to port the Hiccup library to ClojureScript. The goal
is to have a port of Hiccup that has exactly the same api. This
would make it possible to write views once (provided no platform
specific code is used), and run them on the server with Clojure
and on the client with ClojureScript.

At the moment I copied most of the Clojure files and made some
modifications where necessary. The whole Hiccup testsuite runs
fine in the browser, as well in a headless v8 session.

However I have one last hurdle to take. Most macros I can use in
Clojure and in ClojureScript with some minor adjustments, except
the "defelem" macro in the "hiccup.def" namespace. To get this
one running in ClojureScript I had to change it's implementation
and move it to the "hiccup.macro" namespace.

The problem with this macro is, that it uses the alter-var-root
fn to add additional functionality to the given fn. As far as I
can tell there is no alter-var-root in ClojureScript. I got the
code running by using set! in the ClojureScript version.

The original Clojure macro:

https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/def.clj#L38

The ClojureScript macro:

https://github.com/r0man/hiccup/blob/clojurescript/src/clj/hiccup/macro.clj#L13

Is anyone aware of a solution that would share the same code and
work in both cases? Are there plans to add alter-var-root to
ClojureScript as well?

Thanks, Roman.

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