scala - Compile-Time Check on AnyVal for Allocation? -


the scala docs discuss anyval.

in when allocation necessary section, mentions:

case class p(val i: int) extends anyval val p = new p(3) p match { // new p instantiated here   case p(3) => println("matched 3")   case p(x) => println("not 3") } 

is possible, @ compile-time, know whether anyval requires allocation, i.e. put onto heap rather stack?

furthermore, i'd write above code, , then, @ compile-time, receive warning p match { results in allocation.

as understand, allocation defeats purpose of anyval.


Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -