From e2a34984527c0437cd42476934d0c22164551eed Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 17 Oct 2013 14:15:28 +0200 Subject: Make parameters to implicit value classes private So that they aren't offered as an autocomplete suggestion: implicit class Shouty(string: String) extends AnyVal { def SHOUT_! = string.toUpperCase + "!" } "". // autocompletion offers `.string` here The original incarnation of value classes didn't allow this sort of encapsulation, so we either invented goofy names like `__thingToAdd` or just picked `x` or `self`. But SI-7859 has delivered us the freedom to keep the accessor private. Should we keep any of these accessors around in a deprecated form? The implicit classes in Predef were added in 2.11.0-M2 (c26a8db067e4f), so they are okay. I think we can make reason that these APIs were both accidental and unlikely to be interpreted as public, so we can break them immediately. scala> Left(1).x res0: scala.util.Either[Int,Int] = Left(1) scala> import concurrent.duration._ import concurrent.duration._ scala> 1.n res1: Int = 1 --- test/files/presentation/callcc-interpreter.check | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'test/files/presentation/callcc-interpreter.check') diff --git a/test/files/presentation/callcc-interpreter.check b/test/files/presentation/callcc-interpreter.check index 59c841a255..d41b982614 100644 --- a/test/files/presentation/callcc-interpreter.check +++ b/test/files/presentation/callcc-interpreter.check @@ -3,7 +3,7 @@ reload: CallccInterpreter.scala askTypeCompletion at CallccInterpreter.scala(51,38) ================================================================================ [response] askCompletionAt (51,38) -retrieved 63 members +retrieved 59 members abstract trait Term extends AnyRef abstract trait Value extends AnyRef case class Add extends callccInterpreter.Term with Product with Serializable @@ -52,10 +52,6 @@ final def synchronized[T0](x$1: T0): T0 final def wait(): Unit final def wait(x$1: Long): Unit final def wait(x$1: Long,x$2: Int): Unit -private[this] val __leftOfArrow: callccInterpreter.type -private[this] val __resultOfEnsuring: callccInterpreter.type -private[this] val __stringToFormat: callccInterpreter.type -private[this] val __thingToAdd: callccInterpreter.type private[this] val term0: callccInterpreter.App private[this] val term1: callccInterpreter.App private[this] val term2: callccInterpreter.Add -- cgit v1.2.3