[SI-8603] Improve REPL display of String values Created: 19/May/14 Updated: 01/Nov/16
|Project:||Scala Programming Language|
|Component/s:||Repl / Interpreter|
|Affects Version/s:||Scala 2.11.0|
|Reporter:||A. P. Marki||Assignee:||Unassigned|
In Scala REPL (interactive interpreter), type this:
scala> Set(1, "1.2")
The result does not put a quote on "1.2". Then the user cannot easily see what type each member is in the set. In addition, for the following:
scala> Set(1, "1.2 ")
Quotes are added for string with leading/trailing whitespaces. This adds inconsistency. Also considering the following:
scala> Set(1, "1.2, 55")
Isn't the result confusing?
Please consider always adding quotes on strings in REPL result. Thank you.
PS: Original google group post for this issue is here:
|Comment by A. P. Marki [ 19/May/14 ]|
Example confusion, compounded by quoting.
|Comment by Li Haoyi [ 19/Apr/15 ]|
This is fixed in the Ammonite REPL
As you can see, Set[Any] behavior still isn't great, but most people don't deal with `Any`s much anyway. Set[T] for any strongly-typed T is pretty-printed properly in the same way a literal would be written