ClojureScript

Details

Type:
Enhancement

Status:
Closed

Priority:
Minor

Resolution:
Completed

Affects Version/s:
None

Fix Version/s:
None

Component/s:
None

Labels:

None

Patch:

Code

Description

Many of the compiler options (esp. :libs, :externs, etc.) that are accepted by the compiler (and commonly specified via lein-cljsbuild options) should also apply to ClojureScript REPL sessions. Since all known IJavaScriptEnv implementations are records, the most straightforward way to do this is to allow one to add such options to REPL environment records, which can then be passed on to the compiler in cljs.repl.

Making this change has had a big impact on my personal ClojureScript productivity. Interested in the patch?

OK, I had no idea :none was even an option; found where it comes into play just now when I grepped cljs.closure. (I saw the case in cljs.closure/make-options, and worked from there.) I'll redo the patch with :none, test with some downstream REPL envs to make sure everything works as expected, and re-attach.

Chas Emerick
added a comment - 28/Oct/13 11:40 AM OK, I had no idea :none was even an option; found where it comes into play just now when I grepped cljs.closure. (I saw the case in cljs.closure/make-options, and worked from there.) I'll redo the patch with :none, test with some downstream REPL envs to make sure everything works as expected, and re-attach.

That's only the default used if the REPL environment doesn't specify one, and if the REPL environment uses Closure optimization to begin with. The only stock REPL environment that does any optimization is the browser REPL, which defaults to :simple; without anything else to go on, it seemed reasonable to copy it.

The only alternative would be :whitespace. I have no objection to defaulting to that, but I don't see any practical difference between the two given the REPL context.

Chas Emerick
added a comment - 28/Oct/13 8:58 AM That's only the default used if the REPL environment doesn't specify one, and if the REPL environment uses Closure optimization to begin with. The only stock REPL environment that does any optimization is the browser REPL, which defaults to :simple; without anything else to go on, it seemed reasonable to copy it.
The only alternative would be :whitespace. I have no objection to defaulting to that, but I don't see any practical difference between the two given the REPL context.

AFAICT, the only options where this makes sense are :libs and :foreign-libs. These two are needed to allow you to have dependencies loaded as they would be using e.g. lein-cljsbuild. The rest of the ClojureScript compiler options are of relatively minimal use in the REPL.

This conveniently keeps the scope of the change down, affecting only the dependency-loading bits in cljs.repl.

Chas Emerick
added a comment - 21/Oct/13 2:38 PM - edited AFAICT, the only options where this makes sense are :libs and :foreign-libs. These two are needed to allow you to have dependencies loaded as they would be using e.g. lein-cljsbuild. The rest of the ClojureScript compiler options are of relatively minimal use in the REPL.
This conveniently keeps the scope of the change down, affecting only the dependency-loading bits in cljs.repl.
I'll update the relevant wiki page to reflect this change once this is applied.