Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

Currently calling (enable-console-print!) causes a bunch of code to be retained in :advanced mode even if you never print.

While that is not ideal it doesn't cause runtime errors. Not calling it and trying to print however will throw an exception which will potentially break your app.

No *print-fn* fn set for evaluation environment

So we end up in a no-win situation for :advanced builds where a "forgotten" {{prn}} may break your app in production or "maybe" bloating your file size by retaining all the print-related things.

I think the no-print-fn condition should never throw, maybe just try to write a warning using console.log. Or just dropping the {{prn}} altogether.

4 Answers

0 votes
by

Comment made by: dnolen

Let's move the old behavior to string-print only.

0 votes
by

Comment made by: mfikes

The attached CLJS-2002.patch moves the throw to {{string-print}} and using {{nil}} as the init for the two Vars solves CLJS-2231. But it doesn't address the ticket as written: Leaving an inadvertent {{prn}} in your code leads to a call to {{string-print}} which throws.

0 votes
by

Comment made by: dnolen

https://github.com/clojure/clojurescript/commit/797e247fbef676544060a57da995f058db061f37 partially addresses this issue. Keeping this open and moving to lower priority, we should revisit.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJS-2002 (reported by thheller)
...