Reputation: 6689
I am doing Martin Odersky course on Scala, because some basic Scala knowledge is requirement for upcoming project of mine.
In one of the first lectures there is a talk about substitution model of evaluation, and that it works if the expressions have no side effects. Now, I am wondering if internally Scala somehow detects if the code has some side effects? Or was it introduced just to show how evaluation could work if no side effects could be possible in language?
Upvotes: 2
Views: 202
Reputation: 26486
What you're asking about is called an "effects system" and to date Scala does not have one. They're not easy to create when the language includes mutable constructs as Scala does. There has been talk of implementing one but to my knowledge no one has embarked on it yet.
Upvotes: 2