If it was said that "functions are first class values" does it mean that in case when we use "def" for variable declarations, the memory allocation to store the value will take place ?
Asked
Active
Viewed 153 times
0
-
4No. `def` declares [methods, not functions](https://stackoverflow.com/questions/2529184/difference-between-method-and-function-in-scala). – Alexey Romanov Feb 13 '19 at 10:17
-
2Possible duplicate: [Difference between method and function in Scala](https://stackoverflow.com/questions/2529184/difference-between-method-and-function-in-scala). – Andrey Tyukin Feb 13 '19 at 14:53
-
Also, there is no such thing as "memory allocation" in Scala. – Jörg W Mittag Feb 13 '19 at 21:09
-
@JörgWMittag Could you please elaborate your statement, please... Do you mean because scala use JVM it follow the java memory allocation principle or you mean something more ? – Tim Florian Feb 15 '19 at 09:47
-
@TimFlorian: No, I mean because the Scala Language Specification does not say anything about memory allocation and leaves it up to the individual implementation how to allocate memory. Also, it is not true that Scala uses the JVM. The Scala Language Specification does not require usage of the JVM. And for example, Scala.js does not use the JVM, and Scala-native also does not use the JVM. – Jörg W Mittag Feb 15 '19 at 20:12