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

The REPL incorrectly prints some strings with dollars in them #9335

Open
scabug opened this Issue May 28, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented May 28, 2015

scala> val x = "Foo$line3.$read$"
x: String = Foo

scala> x
res66: String = Foo

scala> println(x)
Foo$line3.$read$
@scabug

This comment has been minimized.

Copy link

scabug commented May 28, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9335?orig=1
Reporter: Guillaume Martres (Smarter)
Affected Versions: 2.11.6
See #4884

@scabug

This comment has been minimized.

Copy link

scabug commented May 28, 2015

@SethTisue said:
This comes up from time to time and is always good for yucks. See also #4884

@scabug

This comment has been minimized.

Copy link

scabug commented May 28, 2015

Guillaume Martres (Smarter) said (edited on May 28, 2015 1:29:38 AM UTC):
I guess I shoudl also say that I discovered that while playing with reflection:

scala> class A { val x: Int = 1 }
defined class A

scala> val a = classOf[A].getDeclaredFields
a: Array[java.lang.reflect.Field] = Array(private final int A.x)

scala> a(0).toString
res2: String = private final int A.x

scala> a(0).toString.toList
res3: List[Char] = List(p, r, i, v, a, t, e,  , f, i, n, a, l,  , i, n, t,  , $, l, i, n, e, 6, ., $, r, e, a, d, $, $, i, w, $, $, i, w, $, A, ., x)

@scabug

This comment has been minimized.

Copy link

scabug commented May 28, 2015

@som-snytt said:
There's a ticket for documenting the REPL, but until then, this ought to be less of a secret:

scala> $intp.isettings.unwrapStrings = false
$intp.isettings.unwrapStrings: Boolean = false

scala> val x = "Foo$line3.$read$"
x: String = Foo$line3.$read$

scala> class A { val x: Int = 1 }
defined class A

scala> classOf[A].getDeclaredFields()(0)
res1: java.lang.reflect.Field = private final int $line7.$read$$iw$$iw$A.x

I wonder if Ammonite resolves the documentation bug already.

@scabug scabug added the repl label Apr 7, 2017

@SethTisue SethTisue added this to the Backlog milestone Mar 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment