Fork me on GitHub

@bozhidar you have any suggestions for my problem, where I'd like to prevent a value which implements IDeref from being derefed when it's pretty printed as a return value in cider?


I can look in a bit but I’m guessing it’s an extend method we added to the print mechanism. Should be overridqble back and that is a bug in my view


Hmm. This sounds weirder and weirder. Since derefing can trigger blocking and on delays can trigger computation prematurely.


Yeah, I also implement IBlockingDeref and that impl isn't used ever


The problem is I'm trying to implement custom promises in order to prevent a breaking change to my api, but I don't want to have to require my users have cider or nrepl on their classpath to run the application, but I also don't want it to hang if they try something out on the repl


Yeah agreed


Hopefully there’s a way to fix up in code without waiting on a release


(def ^:dynamic pretty-objects "If true, cider prettifies some object descriptions. For instance, instead of printing functions as #object[clojure.core$PLUS 0x4e648e99 \"clojure.core$PLUS@4e648e99\"] they are printed as #function[clojure.core/+] To disable this feature, do (alter-var-root #'cider.nrepl.print-method/pretty-objects not)" true)


You can turn it off with that dynamic var. can probably easily redef the print-method for ideref in your repl and that should be removed I think


@suskeyhose i'm looking into this some more. I see that the printer for the c.l.IDeref checks to see if a) its also IPending and b) if so, if its realized. ( Is it possible for you to also add IPending to your custom promise types such that the printer works better? I still think this is a bug in cider-nrepl but this also might allow you to add a bit more onto your type to make it a bit better as well


I'm actually less convinced this is a bug. in a bare clj repl:

~/p/d/cider-nrepl ❯❯❯ clj
Clojure 1.10.1
user=> (reify clojure.lang.IDeref (deref [_] (do (prn "i'm gonna sleep a while") (Thread/sleep 3000) :slept/value)))
"i'm gonna sleep a while"
#object[user$eval136$reify__137 0x29182679 {:status :ready, :val :slept/value}]
just printing the reify will cause it to deref. the printer side-effects that. You need to add the IPending instead


Seems I’m late to this conversation and you’ve made plenty of progress without me. Might be a good idea to move this to some issue, so that the important points won’t get lost with the Slack history.


cross post alert! posted in #clojurescript, too...


to try the code at I created the project with

lein new figwheel cljs-weather -- --reagent
added the code and dependencies, and then ran
then opened the project in emacs, where I ran
and the project opened in my browser. I can evaluate simple forms in core.cljs like (+ 1 1) with cider-eval-defun-at-point but trying to evaluate the ns form or, trying to get data from the web with (GET <some url>) causes me to get
Caused by java.lang.RuntimeException
   Unable to resolve symbol: GET in this context
so, what do I have to do to be able to evaluate forms in my buffer as with clj in a cljs project?


@patrickanium I guess you forgot to load the buffer first (`C-c C-k`) and your requires are not in scope.


@dpsutton Thanks for the tip! Just implementing a basic implementation of IPending fixes the issue.

cider 1

@bozhidar how do I get the requires in scope?


I loaded the buffer with C-c C-k but it errors on the first form (the ns one with the require).


whoa... just changed to clojurescript-mode (M-x clojurescript-mode) and it works!


thanks for the help 🙂