Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created December 23, 2010 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amalloy/752664 to your computer and use it in GitHub Desktop.
Save amalloy/752664 to your computer and use it in GitHub Desktop.
;; This is how namespaces are serialized to a string
clojail.core> (print-dup *ns* *out*)
#=(find-ns clojail.core)nil
;; This is how they're printed normally
clojail.core> (eval `(println ~*ns*))
#<Namespace clojail.core>
nil
;; Sensibly, you can't deserialize a namespace when read-eval is false
clojail.core> (binding [*read-eval* false] (eval `(println ~*ns*)))
; Evaluation aborted.
;; But why doesn't this work? Shouldn't ~ns expand
;; into (find-ns clojail.core) *before* read-eval is disabled?
clojail.core> (let [code `(println ~*ns*)]
(binding [*read-eval* false]
(eval code)))
; Evaluation aborted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment