-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Improve REPL result printing for String and Product [ci: last-only] #8885
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
Conversation
Check if param check is too forcing at time of invocation.
|
That's a massive run-time behavior change for a lot of code. It's going to break so many things. I really don't we should do that in a minor version, and I would even be very hesitant to do it in a major version. |
@sjrd yes, you've registered that position in the previous PR. This is mostly just for fun; given past discussion, it probably won't fly. But the problem space is small enough to revisit. |
This comment has been minimized.
This comment has been minimized.
Previous art and discussion |
081936b
to
0f11a2b
Compare
Reopening because before it was fixed you would see:
|
0f11a2b
to
ddbd94b
Compare
c6ddc99
to
c176947
Compare
And therefore I'm going to close this to get it out of the PR queue — we can always reopen later if things move forward on the Scala 3 side. |
There is a misunderstanding. Scala 3 is calling into our runtime, and Scala 3 will also benefit when this is merged. |
Okay. Let's summon a Scala 3 reviewer or two, but before we do that, can you attempt to make the PR description user-facing and country simple about what this does and why? (And once you've stated your case, then I guess we can un-draft the PR.) (To be clear, I believe I am in favor of this change, in my heart at least, and I'm trying to help you give it the best chance of making it through... I hope it doesn't come across as being difficult.) |
`replStringOf` takes an int that is the max len to print, not the max number of elements. Special overloads also take a verbose flag for printing element names and quotes around String values. The 3-param overload does not inject extra newlines, so that Scala 3 REPL need not strip them.
c881faf
to
9135f51
Compare
Scala 3 literally needs at least an ellipsis. Can we spare them three dots? Dots in #10178 |
While forward-porting the tpolecat test, I realized the improved stringOf is still not merged for Scala 3 repl. How long, Oh Lord? The message comment is updated to It would be nice to backport, if there is something to backport it on top of. |
Sorry, PR, that I forgot your third birthday. |
@SethTisue said:
|
Relates to #10180 |
Add surrounding quotes to Strings and use verbose toString for Products that are not Tuples.
The goal is limited pretty-printing in REPL.
When arity >= 2 and not opting out with deprecatedName, print param names.
The opt-out idiom is
@deprecatedName("x") x: X
, which means "don't call me by my name." If any parameter is annotated, just use ordinary toString.Note: goal is not pretty-printing but to improve casual
toStringREPL experience.If there is only one param, no disambiguation is required, and the name of the wrapped value is often uninteresting (supposition).
Fixes scala/bug#8603