It's "EvalReader". What it does is cause the expression to be
evaluated at read time:
user=> (read-string "(+ 5 #=(* 9 9))")
(+ 5 81)
You can prevent this occurring by binding *read-eval*:
user=> (binding [*read-eval* false] (read-string "(+ 5 #=(* 9 9))"))
java.lang.RuntimeException: java.lang.Exception: EvalReader not
allowed when *read-eval* is false. (NO_SOURCE_FILE:0)
-R
dispatchMacros['='] = new EvalReader();
then just skip ahead to the EvalReader class definition if you need
additional context to understand what's going on.
HTH.
-R
This is important to know about for security reasons, also. Specifically, if you are receiving Clojure data structures in text form over the network, and don't set *read-eval* to false, you're vulnerable to a "Clojure injection attack". Someone could send you "(+ 5 #=(System/exit 0))" as a denial-of-service attack, just for starters.
> I doubt there's a way to make it safe. There's probably no way to force
> those expressions to run in an applet sanbox, at least without massive
> kludging.
I'm pretty sure clojurebot in the #clojure channel does exactly this kind of
sandboxing for both read and eval.
--Chouser