Hi, I have been using clojure for personal projects for a while now. I am starting to work with clojurescript.
I have a number of utilities and libraries that I use in clojure. I can port much of these wholesale to clojurescript if I copy functions to cljs files. Generally, my feeling is that I would like to be able to separate "generic clojure" from "jvm clojure" from "js clojure". Where "generic clojure" relies only on common capabilities of clojure or clojurescript. "jvm clojure" uses specific jvm/java libs and "js clojure" uses specifically js libs or capabilities. As I understand it, even if I do this, I cannot use clojurescript-compatible clj files in a clojurescript build. (i.e compile the clj file as cljs). Presumably, I could link or rename the files, but I think that in the long run this would be a maintenance challenge. Likewise for copying - if the code is meant to be the same. Does anyone have opinions about how to maximise reuse of existing generic clojure code as cljs code in this manner? ( I know you can require-macros - but this does not work for : defn - for example - unless I am mistaken) Do people feel that this sort of separation would be useful or of marginal benefit? As a corollary (if separation and reuse were possible): - it would be quite useful to he able to define a library as being intended to be generic. The compiler would raise an error if a non-generic capability was employed somewhere in the library dependencies (i.e some inter-op or platform specific lib) - and to be able to require/use a "jvm" or "js" specific implementation of a library (implementing the same api/functions) depending on the compilation context... It may be that some of this is possible with macros etc...my depth of knowledge is limited. I am interested to hear opinions... 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