from the discussion so far I understand that toString will not be changed but that an alternative representation may be introduced.
If that is the case I humbly suggest to actually quote the strings in the output.
Here is an example to illustrate what I mean :
case class Point(x:Int,y:Int)
Currently yields the string
Point(1,1) which you can conveniently copy and paste back into code especially when working from the repl or writing tests. This doesn’t change with the addition of field names.
Now consider the following :
case class Person(firstName:String,lastName:String)
Person(martin, ordersky) notice how the quotes are lost ? this means you can no longer copy/paste this back into code without some more editing. I wish it would output
Person("martin", "odersky") instead.
I stopped counting the number of students that were surprised by that behaviour when teaching the Lightbend’s Fast Track to Scala/Scala Language for Professionals class.
I understand that it simply delegates to the toString call on java.lang.string which removes the quotes but I still would like the behaviour changed (while still honoring
null properly) it would also make empty strings stand out better. This would probably also break a lot of toString usasge but it may make more sense if a new string serialization mechanisms is introduced in the language/standard library.