3 ms·
Just gonna put this out there: Scala is full of these scenarios where very small changes to the code have disproportionately large changes to the outcome. It's
by KirinDave 11y ago
Just gonna put this out there: Scala is full of these scenarios where very small changes to the code have disproportionately large changes to the outcome. It's one of the reasons I'm really not a fan of the language. There are so many features that are mentioned in the literature and lore that you have to learn to not use, for fear of pervasive performance penalties.
This is a great example. I've done a lot of Scala and o found the original version very obvious to read, but only experience tells me why the compiler can't make it efficient. Your version is not really worse in any way, but I think it's fair to say that it shouldn't be obvious to everyone why one is suboptimal at first glance.
- merb 11y agoeven if your downvoted. I think what you wrote is somehow true. it's really hard to optimize. but I don't think that Scala is the only language which has this downside. Also you could write really really awful code with scala.