On Saturday, November 15, 2014 4:56:04 AM UTC-8, Daniel Kersten wrote: > I didn't ask for feature expressions in the survey, but I've been wishing for > a better way for writing cross-target code, especially libraries.
I agree - I once modified a clojure library, using cljx, to make it clojurescript compatible. The original author accepted my mods and refactored the library so that it used crossovers instead (I was grateful for the cljs support, however it was achieved) but now that crossovers have been deprecated, it is back to using cljx for this library. It seems like emulating feature expressions with a pre-processor, as cljx does, is a bit clunky and would be easier to use if implemented via the reader proper. BTW - thanks to all who created/contributed cljx. My comments are not intended to disparage your hard and valuable work. You have made it much easier to support both clojure and clojurescript! Thank you, thank you, thank you! > > I've never quite managed to bring myself to develop with cljx - I love it as > a consumer of libraries, but I haven't quite managed to make it wo wellrk in > my workflow for my own code, so haven't been using it. > I've found it a bit too slow and clunky and don't quite know how it fits with > other tools I use: eg, browser repl, figwheel, devcards. > I also find it less than desirable to run yet another java process alongside > my client nrepl, cljsbuild auto (or figwheel) and server clj application. Its > already a heavier weight setup than I'd like. > I had the same experience. This complexity does nothing to encourage newbies to adopt clojure/script. > I imagine most of these concerns can be addressed in cljx itself, of course, > but as it stands it's not ideal and improvements are needed -somewhere-. If > it's part of the reader, though, then I don't need a separate stage. Plus any > code invoking the reader would be target aware. > I think feature expressions might be useful for rare use cases that aren't easily covered by some careful library/API design to hide some differences in platform support. Unfortunately, feature expressions (or cljx) seem to be needed for some very common use cases - specifically I'm thinking of the lack of macro support in cljs - not because of a platform difference but due to a limitation in the compiler, the lack of eval as I understand it. I would much rather see that get fixed than to rely on feature expressions as work around. Of course, I'm probably misunderstanding something here so please enlighten me :-) I would like to see the core clojure language bring clojurescript into the fold in a more tightly integrated and simpler way. On the other hand, I agree that feature expressions could be a pandora's box that has the potential of bifurcating the community of libraries rather than make them more common. It is one thing to use FE for #+clj or #+cljs (to target platform differences) but what about #+foo, #-bar or even #+(or foo baz)? And how does this factor into dependent libraries (AOT compilation?) with or without a given feature set? I know it isn't exactly the same thing but look at what #ifdef did to C and C++... conditional compilation is often the first thing programmers reach for rather than properly abstracting/structuring their code. Conditional compilation doesn't compose very well either. Alan -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
