What do people who are writing scripts for Planck do when it comes to using spit
, and other things that are at the top-level in Clojure but require an import in Planck?
I'd like to write "scripts" that will work as-is in Clojure as well as Planck, but can't do that when I use spit
etc.
I often :refer
them
Oh, in your ns? If I (:require [planck.core :refer [spit]])
, will that not make Clojure yell?
<goes to try now>
Yeah, Clojure will get mad since it can't find Planck. I am talking about Clojure (not cljs) because often I'll write little projects and because lein run
is so slow, I often switch to planck
But not this nice workflow doesn't work for code using spit
, slurp
, format
, and usually I just make a Planck-only version, but it'd be nice to have a single file for lein/clojure and for planck
I guess the Lisp way would be to keep the lein repl open all the time and reload my functions into it as they change 😛 I can try that
Is it possible to add custom reader conditionals? It seems like that would be the right solution here if its doable. I didn’t find anything from a quick google talking about registering a new platform though.
I was thinking the same… I don’t know if you can...
But at least for Clojure and Planck you can use :clj
and :cljs
Right. I guess it only matters if you want to support browser cljs and planck cljs
Theres a note at the bottom of the design page for reader conditionals but sounds like its a potential future feature and I doubt there has been any work done to support it yet: http://dev.clojure.org/display/design/Reader+Conditionals