Fork me on GitHub
#nrepl
<
2019-11-09
>
pez13:11:44

Is there a reason why zprint dependencies are not provided directly with cider-nrepl as they are with puget and fipp?

dominicm20:11:12

Puget and fipp are grandfathered in. They'd be removed if it wouldn't break the backwards compatibility. The goal is to make cider lighter.

pez20:11:53

Oki. Not sending the PR then. 😎

pez22:11:09

I am having problems giving zprint this option map over nREPL: {:record {:to-string? true}}, because I don’t seem to be able to bencode booleans to anything else but 0/1, and zprint checks that it is a boolean… Is it possible to send a boolean proper over bencode? Or is there some other way I can achieve this? Feels like a problem I should have encountered before, but I haven’t…

shen19:11:47

I wonder if we should read-string the value?

shen19:11:39

It feels quite limiting to only be able to use what can survive the bencode conversion to and fro

shen19:11:23

Googling ":nrepl.middleware.print/options" doesn't yield that many results, so I'm guessing this doesn't get used much other than to pass {:right-margin 70} or similar around

pez10:11:50

Yeah, it is a bit surprising that it took me so long to run in to this limitation. A bit hard to see how it could be fixed though...

shen12:11:39

I think if we allowed that to be passed as a (edn) string (v.s. bencode map), that could be better?

shen12:11:16

that would require a (non-breaking) change to nrepl though

pez12:11:51

Could be made opt in, though?

shen12:11:35

yes definitely

shen12:11:20

(if-not (string? opt) opt (read-string opt)) in the right place

pez12:11:07

I was more thinking in some config of the transport.

shen12:11:45

guess we could even allow boolean in the bencode transport. Would just need to think about how to encode it

shen12:11:22

(I don't think it's part of the bencode spec)

pez12:11:33

It isn't. But, yeah, doesn't need to be. haha.

pez12:11:16

b0e/`b1e`, or bfe/`bte`, maybe.

pez12:11:04

Would be nice to be able to transfer nil as well.

shen13:11:51

I just had a look around at how various other bencode implementations dealt with this. Nothing jumped out as an especially good options

shen13:11:30

something different:

shen13:11:48

what are you trying to use as the print-fn for zprint?

shen13:11:59

zprint.core/zprint doesn't have the right signature

shen13:11:12

it needs to be [value writer options]

shen13:11:19

not actually sure what has that signature, other than the built in fn's

shen13:11:08

(i.e. to use zprint, you might need to provide a wrapper fn anyways

pez13:11:40

I'm using cider.nrepl.pprint/zprint-pprint, and providing the options via nrepl.middleware.print/options.

shen13:11:13

(if (get-in options [:record :to-string?]) (update-in options [:record :to-string?] boolean) options)

shen13:11:59

cider-nrepl releases way more frequently than nrepl itself

pez13:11:47

Kim Kinnear is going to relax the spec to allow for 1 as representing not false. So this particular option will be covered that way.