Creating a DSL: How to load a clojure file in the current context -
i trying create dsl packaging software using clojure. want define macros, functions, etc. , load file, , want of things define in same namespace file itself, if define macro abe
, can use in file without using abe
's qualified name.
i have far:
(binding [*ns* (find-ns 'my-namespace)] (load-file "myfile"))
but feeling i'm doing wrong.
also, nice have locally bound variables accessible within clojure file. this:
(let [a 1] (binding [*ns* (find-ns 'my-namespace)] (load-file "myfile")))
where a
usable within myfile
.
the idea allow programmer specify how package in real clojure, language extended in ways transparent programmer.
is there better way this? there better "idiomatic" way of creating dsl in clojure?
Comments
Post a Comment