In my app I'm providing some interface to users that they can provide code and app evaluates that code within sandbox(so eval fn not allowed).The thing is I need to catch if user overrides some built-in function such as =

Any ideas how to catch and prevent that thing?(The idea is they should not be able to do that)

Code:

(defn = [] //some code) WARNING: = already refers to: #'clojure.core/= in namespace: user, being replaced by: #'user/=

One solution might be:

I was trying to get the warning message as String but with-out-str function did not work.

(with-out-str (defn = [])) ;=> ""

Also wrote that with-err-str (changed with-out-str little bit) did not work as well.

(defmacro with-err-str [& body] `(let [s# (new java.io.StringWriter)] (binding [*err* s#] ~@body (str s#)))) (with-err-str (defn = [])) ;=> ""