-
-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use streamed printing of values #336
Comments
So if I understand correctly, I effectively need to concatenate all |
Generally you don't need to concatenate them. In most cases it should be fine to just start printing the chunks (that's what I do in CIDER). That also ensure that the users start seeing something as quickly as possible.
This particular middleware never fails. If it fails you won't get a string representation of a value in the first place. It's also always available, provided you're on nREPL 0.6, which pretty much is these days (it's the version bundled with recent Lein and Boots). Basically you used to get one |
The middleware can certainly "fail" if you pass it the name of a print function that doesn't exist, for example. Right now I'm in a position where if Cider is installed, I'll get back |
Ah, I finally got what you mean. Sorry! Well, you'd have the same problem without streamed printing as well - pretty printing and streamed printing are not really related. I think the term pretty-printing right now is a misnomer as the new functionality is just a generic printing facility for any response key. I guess we can safely assume that if users start poking the printer and its configuration they should know what they are doing, right? For your particular case the values won't be |
Oh I'm not talking about a list, I'm talking about literally sending 2 different expressions on a single line. It's not a particularly compelling use case - it probably happens more often accidentally than deliberately - but the accidental case still means you get confusingly corrupted output. |
Okay I finally booted up Emacs: user> 1 2
12
user> At least I'm not crazy. |
Definitely! That's an oversight our part (nREPL's team). Evaluating multiple expressions is so uncommon (and not supported by Piggieback at all for performance reasons - nrepl/piggieback#98), that we forgot about it. I'll open an upstream ticket. I wouldn't worry about this use-case too much, though, as you're the very first person to spot this problem. |
Btw, when debugging this I've noticed that there's actually one extra message after each complete value:
I know that's no ideal, but it can be used as a way to differentiate the multiple results. |
More precisely, the behavior appears to be:
It's a little convoluted, but certainly seems possible to disambiguate. Tag me in on whatever issue ends up getting created, I wanna see where this goes. |
Value streaming is a new feature in nREPL 0.6 and it allows the clients to receive results in chunks and to interrupt the evaluations resulting in something huge (this also extends to output, btw). I've written about it a bit here. The official docs are here. Switching to streaming printing of everything is a great quality-of-life improvement and requires minimal changes to clients.
The text was updated successfully, but these errors were encountered: