Anybody here?
Yes
I’m chatting over in #rebl with people trying to get https://github.com/RickMoynihan/nrebl.middleware to work.
My understanding is that in nrepl responses, the :value
should always be a string, since it’s the pr-str
ed evaluation result.
The doc backs that up: https://nrepl.org/nrepl/0.6.0/design/overview.html#_responses
> value
The result of printing a result of evaluating a form in the code sent in the corresponding request.
I’m still on the old nrepl, and that has always been true there.
@maxt has been doing some experimentation, and is sometimes seeing nil
values in responses.
nrebl.middleware implements Transport send, which gets the same request twice, but with different keys in the response map. First time it includes :value
, the second time it gets :status #{:done}
without value.
@maxt That is expected - not all messages include a :value
Does that mean that when you’re getting nil
from :value
, that it’s just because there’s no :value
entry at all?
Yes, I just read up on that.
@cfleming most likley. I'll test to wrap it in a check for the existence of the :value key.
Could :value ever be nil
?
Simply wrapping it in (when value ,,,)
works great from what I can see.
Over in #rebl, @lilactown has reported that he does indeed see the values correctly in REBL, using CIDER and nREPL 0.5.x. Could it be that the CIDER middleware is causing the :value
to be an actual value, i.e. a non-`pr-str`ed string?
@maxt In my experience (all with old nREPL), if that :value
is present it is never nil.
But (when value ...)
seems like a fine check to me.
Actually, looking at the Cursive code I do (when-let [val (:value item)]
so I’d never know if there were nil
values, but they seem safe to ignore if there ever are any.
@cfleming This patch seems to work well for me in Cursive. https://github.com/RickMoynihan/nrebl.middleware/pull/16 I can also successfully combine it with https://github.com/RickMoynihan/nrebl.middleware/pull/11 to get a nrepl REBL working as a clojure.main rebel. I have not, however, tested it with any other editor.
I think @cichli has been doing a lot of work on nrepl recently and might have some thoughts