Skip to content

Instantly share code, notes, and snippets.

@Arneball
Created March 30, 2015 15:30
Show Gist options
  • Save Arneball/43c48e2bf2d4f4e88fbc to your computer and use it in GitHub Desktop.
Save Arneball/43c48e2bf2d4f4e88fbc to your computer and use it in GitHub Desktop.
scala> :paste
// Entering paste mode (ctrl-D to finish)
trait Context
object Helper {
def stuff(implicit c: Context) = 3
def stuff_=(i: Int)(implicit c: Context) = ()
// woot
type C[_] = Context
def stuff2[T: C] = 3
def stuff2_=[T: C](i: Int) = ()
}
object Test {
implicit val c: Context = ???
val s1 = Helper.stuff
Helper.stuff = 3
val s2 = Helper.stuff2
Helper.stuff2 = 3
}
// Exiting paste mode, now interpreting.
<console>:23: error: reassignment to val
Helper.stuff2 = 3
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment