nrepl

https://github.com/nrepl/nrepl || https://nrepl.org
craftybones 2019-02-24T05:27:08.030400Z

Anybody here?

dominicm 2019-02-24T07:03:20.030600Z

Yes

cfleming 2019-02-24T22:34:37.031300Z

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

cfleming 2019-02-24T22:35:23.032200Z

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

cfleming 2019-02-24T22:36:03.032700Z

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.

cfleming 2019-02-24T22:36:23.033100Z

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

cfleming 2019-02-24T22:37:59.034Z

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

2019-02-24T22:51:04.037200Z

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.

cfleming 2019-02-24T22:54:55.037600Z

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

cfleming 2019-02-24T22:55:35.038700Z

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

2019-02-24T22:55:38.038800Z

Yes, I just read up on that.

2019-02-24T22:57:06.040300Z

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

2019-02-24T22:57:44.041Z

Could :value ever be nil?

2019-02-24T22:58:23.042100Z

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

cfleming 2019-02-24T22:58:50.042600Z

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?

cfleming 2019-02-24T22:59:34.043100Z

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

cfleming 2019-02-24T22:59:52.043500Z

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

cfleming 2019-02-24T23:00:33.044300Z

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.

2019-02-24T23:49:00.048Z

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

dpsutton 2019-02-24T23:51:21.048900Z

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