5 ms·
Scala 2.8 Preview
- jimbokun 17y agoAdding continuations in a "dot" release seems a pretty big deal!
- moeffju 17y agoIt is a major release of Scala, as the announcement states.
- wooby 17y ago"Support for continuations. A compiler plugin will support continuations as an optional feature of Scala, using a type-directed continuation passing transform. Continuations are useful to implement advanced control constructs, for instance for asynchronous I/O, user interface event handling, or dataflow concurrency." I didn't think continuations were possible on the JVM. Any idea how they're doing this?
- amalcon 17y ago"using a type-directed continuation passing transform." So it converts your program to continuation-passing style, which you can do in any environment if you're willing to mangle the program enough. I would not expect it to be fast.
- rcoder 17y agoMy understanding is that Scala already wraps lambdas in internal class instances with a `call` method, so I would imagine that CPS will carry a similar performance and memory hit. It certainly won't be quite as fast as idiomatic Java code, but it should be considerably faster than other non-local exit implementations that rely on exception handling to manipulate the stack.
- jcl 17y agohttp://blog.richdougherty.com/2009/02/delimited-continuations-in-scala_24.html http://blog.richdougherty.com/2009/02/delimited-continuation... It sounds like you will only be able to do continuations within Scala code, not over a call-stack that includes Java/Scala transitions. (...which is entirely feasible. After all, many interpreters for continuation-friendly languages are built on top of C, which has no continuations.)
- wooby 17y agoAs far as I understand this page, it's actually possible to implement continuations in C: http://homepage.mac.com/sigfpe/Computing/continuations.html http://homepage.mac.com/sigfpe/Computing/continuations.html
- carterschonwald 17y agoI think that the key bit is having it be type directed, so that they can have an explicit concrete representation of the stack as a datastructure that the jvm can optimize, but thats just me speculating
- rcoder 17y agoHonestly, I'm most excited about the seemingly mundane parts of this update: named and default args, and package objects. The big reason that Scala appeals to me more than Haskell or ML for building non-trivial systems is the pragmatic way it approaches real-world program construction. I think that adopting the best features of existing OO languages like Python (named/default args, first-class packages) and Ruby (flexible syntax for pseudo-DSLs, pervasive use of lambdas/blocks in stdlib for iteration and control) while running atop the JVM is a great strategy.