Dotty: REPL pretty-printed output does not distinguish between escape sequences and escaped escape sequences

Created on 10 Jan 2018  路  6Comments  路  Source: lampepfl/dotty

These strings are different:

scala> "\n" 
val res0: String = "\n"
scala> "\\n" 
val res1: String = "\n"
repl bug low fix available

All 6 comments

I think this could be fixed by simply adding the backslash as a special case to be escaped in library/src/dotty/Show.scala for stringShow and charShow.

@jendrikw Makes sense, wanna try?
The duplication between stringShow and charShow can probably also be refactored using in stringShow

str.foreach { sb.append(c.show) }

I'll do it this weekend. Is there a reason this is not written as map and mkString?

That's from e4f7b386d42352cea79b2a385668ce47e15cb13c; I'm not sure whether unspecific fears about map performance are relevant, and I'm still hoping that inlining would fix any issue, but maybe @smarter knows? Or using CI's performance testing (by writing "test performance please", like for instance https://github.com/lampepfl/dotty/pull/4084#issuecomment-371477239), could help being sure, but I'm not 100% sure how it works 馃槄

Dotty isn't going to inline anything compiled by Scala 2, including the standard library. Running our standard benchmarks won't help you here since we don't benchmark the REPL. In any case, I doubt this is going to make any perceivable difference in performance.

In any case, I doubt this is going to make any perceivable difference in performance.

That's what I hoped, thanks! So @jendrikw go ahead!

Was this page helpful?
0 / 5 - 0 ratings