Thanks, Chas! Appreciate the detailed reply. Shantanu
On Monday, 12 August 2013 21:26:31 UTC+5:30, Chas Emerick wrote: > > > On Aug 11, 2013, at 5:19 PM, Shantanu Kumar wrote: > > > Hi, > > > > I am thinking about how to use Cljx correctly in my projects (for > portability); I have few questions: > > > > 1. I understand the Cljx plugin generates .clj and .cljs source code in > target/classes destination. Does that mean, when I generate a JAR for > distribution it again must be processed by Cljx to generate variant > specific code at runtime? (Is my assumption correct?) > > > > 2. Does Cljx support ClojureCLR yet? I noticed one mention of `clr` on > the Cljx README but haven't heard anybody using yet. > > > > 3. On what occasion should I consider lein-dalap instead of Cljx? > > Hi Shantanu, > > Some answers: > > 1. Yes, cljx implies a transformation step each time you need to package > Clojure or ClojureScript code, whatever the context. The Leiningen plugin, > hooks, and nREPL middleware (so as to make loading code from .cljx files > directly into REPL sessions, whether they be Clojure- or > ClojureScript-flavoured [via piggieback]) are all provided to make this as > painless as possible. > > 2. No, cljx does not support ClojureCLR (yet?). Doing this would be quite > straightforward: add a clr-rules map (similar to those found @ > https://github.com/lynaghk/cljx/blob/master/src/cljx/rules.clj#L71), and > a suitable shortcut for it in the plugin itself (around > https://github.com/lynaghk/cljx/blob/master/src/cljx/core.clj#L78). (The > latter can probably be generalized into a map lookup once there's three > default rulesets.) That will take care of emitting the right code when > `lein cljx` is run. nREPL middleware for ClojureCLR (do such things exist > yet?) is another matter; that may be a reason for at least some parts of > cljx to be written in cljx. ;-) > > I think some uncontroversial points of contrast between cljx and > lein-dalap might be: > > * cljx does not privilege any particular target; lein-dalap > assumes/requires Clojure code as its primary representation > * cljx's transformations are completely static (i.e. they are made long > before any of your code is touched by the Clojure runtime, including the > reader); lein-dalap uses either reader or runtime metadata (I can't recall > at the moment) to inform its transformations. > > I contribute and use cljx, so I hope my preference/bias is clear. > > Cheers, > > - Chas -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.