We don't want to emit these in during normal compilation. However it's nice to unify the REPL experience with Clojure's. Currently we just display the value of the def. REPLs could set a :repl build flag which is checked by the emit* :def case. For this to work the analyzer should compile the var AST and include it in the def AST so the compiler can optionally use it.
IRC Feedback from David:
CLJS-934-v4.patch makes two primary revisions:
Introduces a REPL option :def-emits-vars which defaults to true and which is conveyed into the analysis/compilation environment by cljs.repl
The var AST is no longer unconditionally included in the def AST and the analyzer instead looks for :def-emits-vars
Notably, this patch doesn't go so far as to treat :def-emits-vars additionally as a build-affecting compiler option. Rationale: It affects AST generation. It also seems currently unlikely that there would be desire to actually support compiling code with this enabled.
Patch 4 REPL interactions look like this if :repl-verbose is set:
The approach in patch 4 is the right one. When any of the debugging modes are engaged we don't want to generate the "extra" stuff.