6 ms·
Doesn't scala suffer from the JVM constraints, like no tail call recursion, everything is an object, such that the compile times become enormous to work around
by cordite 13y ago
Doesn't scala suffer from the JVM constraints, like no tail call recursion, everything is an object, such that the compile times become enormous to work around them?
Haskell is indeed influencing, but it is not remaining stagnant.
- jonesetc 13y agoThe way I understand it, is that Scala does support tail-call recursion by way of compiling to a loop. Compilation was definitely a pain when I experimented with Sit.
- chc 13y agoScala supports simple recursive tail-call optimization, but is less elegant in handling mutual recursion (due to JVM constraints). Clojure is probably the one you're thinking of that doesn't support tail-call elimination at all. Rich Hickey thought that if you couldn't do it cleanly in all cases (like mutual recursion), you may as well just come up with something else. So instead of optimizing recursive calls, Clojure has the recur function.
- cordite 13y agoI recall that scala uses "trampolines" by compiling to what is more like a state machine.
- judk 13y agoI thought Actors does that, but not Scala in general.(?)
- cordite 13y agoRúnar Bjarnason talked about it in his presentation "FP Programming is Terrible" [0] (he makes up for that title in the end) I asked him about it on twitter since it reminded me of thunks, he said " a trampoline executes a sequence of thunks, yeah" [1] [0]: https://www.youtube.com/watch?v=hzf3hTUKk8U https://www.youtube.com/watch?v=hzf3hTUKk8U [1]: https://twitter.com/runarorama/status/449070763421618176 https://twitter.com/runarorama/status/449070763421618176
- judk 13y agoOnly self recursion, which is a special but common case.
- lmm 13y ago> Doesn't scala suffer from the JVM constraints, like no tail call recursion, everything is an object, such that the compile times become enormous to work around them? Yes. Yes it does. Scala is a bodge that is destined to be replaced (or at least rewritten), and I say that as a huge fan of the language. I would happily bet on Haskell outlasting Scala in the long run. (But I use Scala today, because in the long run we're all dead. Scala inherits a lot of useful production infrastructure from the JVM, and on recent progress it looks like Scala can get faster compiles quicker than Haskell can get better infrastructure. Which means that today, in many environments, Scala is the better choice)
- heavenlyhash 13y agoThe author of scala at one point made some very good responses to questions about compile times on a stackoverflow question here: http://stackoverflow.com/questions/3606591/why-does-intellij-idea-compile-scala-so-slowly/3612212#3612212 http://stackoverflow.com/questions/3606591/why-does-intellij...