Permalink
Browse files

REPL bells and whistles: -Dscala.repl.vids=<Boolean>

Displays identity hashcodes next to `res` values printed by REPL.
This proved quite useful in detecting reflection artifacts that look the same,
but are, in fact, different.
  • Loading branch information...
xeno-by committed Jun 5, 2012
1 parent ab40558 commit 2aaccfe2e311b22a7a93a2a77b2229222f2fb982
@@ -115,7 +115,11 @@ trait MemberHandlers {
if (mods.isLazy) codegenln(false, "<lazy>")
else any2stringOf(req fullPath name, maxStringElements)
""" + "%s: %s = " + %s""".format(prettyName, string2code(req typeOf name), resultString)
val vidString =
if (replProps.vids) """" + " @ " + "%%8x".format(System.identityHashCode(%s)) + " """.trim.format(req fullPath name)
else ""
""" + "%s%s: %s = " + %s""".format(prettyName, vidString, string2code(req typeOf name), resultString)
}
}
}
@@ -23,4 +23,6 @@ class ReplProps {
val replAutorunCode = Prop[JFile]("scala.repl.autoruncode")
val powerInitCode = Prop[JFile]("scala.repl.power.initcode")
val powerBanner = Prop[JFile]("scala.repl.power.banner")
val vids = bool("scala.repl.vids")
}

0 comments on commit 2aaccfe

Please sign in to comment.