I think there are 2 big ideas of relevant to this problem. 1. Tagged literals 2. Compiler-as-a-service
Tagged literals do not have the drawbacks of metadata, or of macros. They are ideal for indicating the semantics of a piece of data. If a piece of data needs to be tagged as representing clojure, clojurescript, clojure-py, or for that matter any language whatsoever, it can be done. Lets give it the polyglot namespace: #polyglot/clj (foo bar) #polyglot/cljs (foo bar) #polyglot/clj-py (foo bar) ... #polyglot/js "foo(bar);" ... #polyglot/common-lisp (foo bar) Now the code can be reliably manipulated as data, and transmitted to compiler services as needed. For the purposes of the previous discussion we need a compile-time macro to pick code corresponding to the current platform, something like (pick-current-platform [#polyglot/clj impl1 #polyglot/cljs imp2]) For some projects it makes sense to segregate things into files for different languages, but that could be a higher level of organization built on top of tagged literal source code representations. Furthermore, powerful things can be achieved using the tagged literal model. It becomes possible to nest languages within one another, to build polyglot systems. For the sake of argument, suppose that tagged code turns into datatypes that implement some useful interfaces. In addition to code compilation, they could also implement Callable. So you could write something like #polyglot/cljs (+ 1 ( #polyglot/clj #(+ % 1) 2) --> 4 (assuming that the compiler/evaluation service has been configured to allow communication between the different hosts) One detail I haven't worked out yet is if the tagged code literals should be quoted, or not. -- 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