- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Re: Re: Yammer moving away from Scala
Wed, 2011-11-30, 23:19
On Wed, Nov 30, 2011 at 5:11 PM, Aleksey Nikiforov <lexn82 [at] gmail [dot] com> wrote:
On Wed, Nov 30, 2011 at 3:43 PM, Jesper Nordenberg <megagurka [at] yahoo [dot] com> wrote:
Aleksey Nikiforov skrev 2011-11-30 21:27:
When I first dicovered that for loops were not optimized I was surpised.
When I discovered a resistance to optimizing them I was shocked. The
decision to do nothing about for loops baffles me to this day.
For comprehensions are just syntactic sugar. Optimizing just them is not very useful, instead effort should be put into generic optimization of HOF's (and other inlining).
This is exactly the thinking that baffles me. There are for-loops in Java. Not comprehensions, LOOPs. Anyone coming from Java will expect for LOOPs or simlar functionality.
It does not matter to me if it is a syntactic sugar or if they are comprehensions. What matters to me is to be able to write the code:
var sum = 0; for (i <- 0 until array.length) sum += array(i)
And have it work as fast as possible. Scala fails that expectation. It fails it so much that this is one of the most frequent questions on stack overflow. Also, it appears to be the number 1 on the list of problems with Scala as viewed by the employee at Yammer who wrote the email:
1. Don't ever use a for-loop.So, they were looking for loops as well, not comprehensions. Why not send them an email and ask them if perhaps they were "talking about for comprehensions or just foreach"?! If you think I was overreacting, I would LOVE to see their response.
It is nice to have for-comprehensions optimized. But I really do not care about for-comprehensions. I want something that looks like for loops and works like for loops. 99% of my code uses emulated for-loops via while-loops. It's painful and error prone, so I take this issue very personally.
I'm pretty surprised by this. I don't think while loops *always* beat for-expression for speed in all cases...
Not providing proper for-LOOPs is akin to saying: Scala is not meant for the applications that require for-loops. Which sends the message that Scala is not meant for performance-sensitive applications. So guess what, the folks at Yammer got the message and went back to Java.
You can tell me that they are comprehensions, or a more general case should be optimized. But I do not care about those uses at all. Ranges and closures can never be optimized to the level of while loops. And I need the LOOPs. And so do many other people not interested in functional aspects of Scala.