planck-repl / planck

Stand-alone ClojureScript REPL
https://planck-repl.org
Eclipse Public License 1.0
1.03k stars 68 forks source link

`eval` is evaluating in @current-ns, which isn't always right #288

Open mfikes opened 8 years ago

mfikes commented 8 years ago

If you consider this, it will work when executed as a script:

(ns foo.core
  (:require [planck.core :refer [eval slurp]]))

(prn (planck.repl/eval '#'slurp (.-name *ns*)))

whereas the current implementation of eval (and related things like resolve) the "current namespace" is taken from @current-ns, which is cljs.user when evaluating a top-level script.

So, if eval were changed to use (.-name *ns*), this would fix things, apart from the issue that occurs when using -K or -k, where *ns* is not set.

pyrmont commented 5 years ago

I couldn't recreate this bug in Planck 2.21.0. Is it still an issue?