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

*print-length* and *print-level* have unexpected consequences with set-env! in the REPL #586

Closed
arsenerei opened this issue Feb 10, 2017 · 2 comments

Comments

@arsenerei
Copy link

Thanks for all the effort you've put into boot!

I was trying to follow this post and got a "Unmatched delimiter: ]" exception when calling (set-env! :dependencies '[[cheshire "5.5.0"]]).

After some debugging, I discovered it was the *print-length* and *print-level* settings in my profile.boot causing the issue.

I'm not sure if this is intended behavior, but it certainly caught me by surprise.

$ boot repl
nREPL server started on port 36881 on host 127.0.0.1 - nrepl://127.0.0.1:36881
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_121-b13
        Exit: Control+D or (exit) or (quit)
    Commands: (user/help)
        Docs: (doc function-name-here)
              (find-doc "part-of-name-here")
Find by Name: (find-name "part-of-name-here")
      Source: (source function-name-here)
     Javadoc: (javadoc java-object-or-class-here)
    Examples from clojuredocs.org: [clojuredocs or cdoc]
              (user/clojuredocs name-here)
              (user/clojuredocs "ns-here" "name-here")
boot.user=> (set! *print-level* 0)
0
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.AssertionError: Assert failed: value not readable by Clojure reader
                          :dependencies => #
                          #
boot.user=> (set! *print-level* 1)
1
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.AssertionError: Assert failed: value not readable by Clojure reader
                          :dependencies => [#]
                          (printable-readable? v'')
boot.user=> (set! *print-level* 2)
2
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Unmatched delimiter: )
boot.user=> (set! *print-level* 3)
3
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Reader tag must be a symbol
boot.user=> (set! *print-level* 4)
4
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Unmatched delimiter: ]
boot.user=> (set! *print-level* 5)
5
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Unmatched delimiter: ]
boot.user=> (set! *print-level* 6)
6
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.5.1
nil

There are similar exceptions with *print-length*

boot.user=> (set! *print-length* 0)
0
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Map literal must contain an even number of forms
boot.user=> (set! *print-length* 12)
12
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])

java.lang.RuntimeException: Map literal must contain an even number of forms
boot.user=> (set! *print-length* 13)
13
boot.user=> (set-env! :dependencies '[[cheshire "5.5.0"]])
Classpath conflict: org.clojure/clojure version 1.8.0 already loaded, NOT loading version 1.5.1
nil
@arsenerei arsenerei changed the title *print-length* and *print-level* has unexpected consequences with set-env! in the REPL *print-length* and *print-level* has unexpected consequences with set-env! in the REPL Feb 10, 2017
@arsenerei arsenerei changed the title *print-length* and *print-level* has unexpected consequences with set-env! in the REPL *print-length* and *print-level* have unexpected consequences with set-env! in the REPL Feb 10, 2017
@RadicalZephyr
Copy link
Contributor

From the doc for set-env! I'm not at all surprised that this fails like this. I guess the right thing to do for boot would be to bind *print-level* and *print-length* to nil in the critical areas where the env is being printed.

RadicalZephyr added a commit to RadicalZephyr/boot that referenced this issue Feb 11, 2017
This should prevent user setting of these values for reasonable use in
the REPL from preventing `set-env!` from failing the
printable-readable round-trip test.

Fixes boot-clj#586.
alandipert pushed a commit that referenced this issue Mar 3, 2017
This should prevent user setting of these values for reasonable use in
the REPL from preventing `set-env!` from failing the
printable-readable round-trip test.

Fixes #586.
@alandipert
Copy link
Contributor

Thanks for the report, this is fixed in master 👍

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

3 participants