anmonteiro/lumo

load-file does not work inside eval context

dundalek opened this issue · 2 comments

I have an example script.cljc with a following content:

(println "Loading script: OK!")

Running load-file in REPL works as expected:

Lumo 1.9.0
ClojureScript 1.10.439
Node.js v10.9.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (load-file "script.cljc")
Loading script: OK!

However, it does not load inside eval:

cljs.user=> (eval '(load-file "script.cljc"))
nil

Interestingly lumo's internal execute-path works inside eval:

cljs.user=> (eval '(lumo.repl/execute-path "script.cljc" {}))
WARNING: var: lumo.repl/execute-path is not public
Loading script: OK!
nil

Would it be possible to make load-file work in eval context as well?

Interesting. load-file is a "REPL special" form which only really works at the REPL. I suppose we didn't predict the case where it would have been called inside eval. Do you wanna work on a fix?

I would like to help out, but I am not sure where to look and what would be needed to change. Do you have any pointers?