简体   繁体   中英

Difference between method type and value in Scala

Reading this post he speaks about "Methods Values" but right in the next paragraph he says that "A Method Type is a non-value type. That means there is no value". Isn't this contradictory? In Scala, does a method have a value or not?

I know that we can't assign a method to a variable (without turning it into a function by using _ ), isn't this enough to say that a method does not have a value?

If m is a method then the method value is m_ which is actually a function. So it has a function type . A method value has a function type. A method type is just the def statement without the body. It cannot be used anywhere! This is how i look at it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM