Skip to content

Instantly share code, notes, and snippets.

@alexarchambault
Created March 31, 2015 15:06
Show Gist options
  • Select an option

  • Save alexarchambault/40b19b406654063ce224 to your computer and use it in GitHub Desktop.

Select an option

Save alexarchambault/40b19b406654063ce224 to your computer and use it in GitHub Desktop.
def cast[T](v: Any): Unit = v.asInstanceOf[T]
def cast1[T](v: Any): T = v.asInstanceOf[T]
val v = BigInt(3)
cast[Double](v) // no exception, there should be one
cast1[Double](v) // exception, but from repl code after cast1 itself
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment