Fork me on GitHub
#nrepl
<
2019-02-24
>
craftybones05:02:08

Anybody here?

cfleming22:02:37

I’m chatting over in #rebl with people trying to get https://github.com/RickMoynihan/nrebl.middleware to work.

cfleming22:02:23

My understanding is that in nrepl responses, the :value should always be a string, since it’s the pr-stred evaluation result.

cfleming22:02:03

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.

cfleming22:02:23

I’m still on the old nrepl, and that has always been true there.

cfleming22:02:59

@maxt has been doing some experimentation, and is sometimes seeing nil values in responses.

maxt22:02:04

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.

cfleming22:02:55

@maxt That is expected - not all messages include a :value

cfleming22:02:35

Does that mean that when you’re getting nil from :value, that it’s just because there’s no :value entry at all?

maxt22:02:38

Yes, I just read up on that.

maxt22:02:06

@cfleming most likley. I'll test to wrap it in a check for the existence of the :value key.

maxt22:02:44

Could :value ever be nil?

maxt22:02:23

Simply wrapping it in (when value ,,,) works great from what I can see.

cfleming22:02:50

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?

cfleming22:02:34

@maxt In my experience (all with old nREPL), if that :value is present it is never nil.

cfleming22:02:52

But (when value ...) seems like a fine check to me.

cfleming23:02:33

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.

maxt23:02:00

@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.

dpsutton23:02:21

I think @cichli has been doing a lot of work on nrepl recently and might have some thoughts