If anyone is interested, this is the strategy that I am currently using. 
It's a bit messy with linking but it saves me maintaining multiple versions 
and has worked so far. I expect that the linking could be removed with some 
work upstream. This is a workaround for me until a more standard solution 
comes out.

I have started to separate code that I believe to be generic form code that 
I believe to be platform specific. It is not always possible to tell due to 
included dependencies, so there may be some trial and error.

If I am making a project - say 'utils' that I think can be used across clj 
and cljs, I use the following structure:

I put generic code in src.
I put jvm specific code in src/utlis/x (namespace utils.x and below)
I put cljs/js specific code in src_cljs/utils/x (namespace utils.x and 
below)

Generic code is developed under src and sym-linked into src_cljs - with a 
change in extension to .cljs

All platform dependent code is in or under the namespace utils.x (I use x 
because it's short and easy to see). This is not crosslinked (obviously).

I do not use 'cljs' or 'jvm' as the name space for platform specific code. 
Using the same prefix 'x' allows generic code to freely use platform 
specific code provided that it is explicitly implemented to the same API in 
both clj and cljs. This may not always be a reasonable thing to do, but 
where it is it seems effective.

Nothing special is required beyond this. I use cljs-watch to compile the 
clojurescript by pointing it at the src_cljs directory.

Cheers

Dave

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