anmonteiro / lumo

Fast, cross-platform, standalone ClojureScript environment
Eclipse Public License 1.0
1.88k stars 85 forks source link

load-file does not work inside eval context #449

Open dundalek opened 6 years ago

dundalek commented 6 years ago

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?

anmonteiro commented 6 years ago

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?

dundalek commented 6 years ago

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?