Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What to do with CLJS *print-fn*? #365

Closed
borkdude opened this issue Jul 16, 2020 · 1 comment
Closed

What to do with CLJS *print-fn*? #365

borkdude opened this issue Jul 16, 2020 · 1 comment

Comments

@borkdude
Copy link
Collaborator

borkdude commented Jul 16, 2020

In CLJS *print-fn* is used rather than binding *out* for controlling output. Currently there is no good way to do (sci/binding [sci/out *out*] (eval-string "(println :foo)")) in CLJS. Maybe we should rather use something like sci/*print-fn* for this.

In normal CLJS, *out* doesn't work like in Clojure:

cljs.user=> (binding [*out* sb] (println :hello))
:hello
nil

but rather you should bind or set print-fn:

cljs.user=> (binding [*print-fn* #(.log js/console ">" %)] (println :hello))
> :hello
nil

So in CLJS it would make sense to expose sci/print-fn which can be bound to a print function which influences how println etc work.

@borkdude
Copy link
Collaborator Author

A first cut has been made in nbb itself: babashka/nbb@a0fd4a0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant