--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I think it is a bug. Even with all the potential implicit magic taken into account, there is only one valid result of null.asInstanceOf[Boolean] and that is a primitive false. Even with the boxing that happens afterwards, it shouldn't result in null.
I did the paperwork and filed an issue for it, linking to this thread and your pull request: https://issues.scala-lang.org/browse/SI-7397
--
It sure looks like it would throw, i.e., null.asInstanceOf[java.lang.Integer].intValue().
Clearly you aren't putting enough time into keeping up with pull requests
Thanks, that helps. Looks like the ol' 20 minute flier crashed and burned though.
I know it's more of a "historical" question now, but I would also be curious to know more about how the "null becomes default primitive" logic in BoxesRunTime came about in the first place. Even better, of course, would be to be able to relegate this to the archives ;-)
class Klass[@specialized(Everything) A]( val a: A )will turn into
trait Klass[A] { def a: A; def a$mcI$sp: Int; /* and 9 other specialized variants */ }Even if we implement the redirects in the trait, we'll still have 10^n classes defining 10^n methods each.
trait Klass$mcI$sp[A](val a$mcI$sp: Int) { def a: A = ...; def a$mcI$sp: Int = ...; /* and 9 other redirects */ }
...
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
What is the argument against throwing a class cast exception?
It's more or less the “canonical” way to get the default values for some type T.