On Tuesday, August 20, 2013 5:09:16 PM UTC-5, Jason Zaugg wrote:First of all, a heads up regarding CPS: We don't have resources assigned for maintenance of the CPS compiler plugin. In fact, we're thinking of declaring it deprecated. It has some architectural issues (most notably: intimate relationship with typechecking under the annotation-driven pluggable subtyping logic) that means it has a long tail of hard- or impossible-to-fix bugs and limitations.I would plead that this plugin not be deprecated if at all possible, our project is entirely dependant on it, and I think Greg's is too. Moreover, there are very few programming languages that support continuations, and even fewer that support portable continuations.While portable continuations might seem to be an esoteric feature, in actuality they are extremely relevant to many of the real-world challenges that programmers face today, in particular the problem of building scalable distributed and fault tolerant software. In my humble opinion, portable continuations are our best chance of achieving the holy grail of allowing software to be written that can be scaled across tens, hundreds, or maybe even thousands of computers - just as easily as writing software to run on a single CPU. The existence of the continuations plugin was what convinced me to base our project on Scala.Typically, useful functionality is only deprecated in an API when there is a better alternative. Deprecating the continuations plugin in favor of an unspecified Futures-based system may seriously screw quite a few people who made quite early bets on Scala. I hope you take that into consideration in your decision to deprecate it.
With all of this in mind, we have to find a way to communicate our view of CPS to potential new users (we'd rather that *more* projects didn't start depending on it) while providing some sort of migration path for your projects. The plugin could be maintained by a third party, for example, we're not planning to remove the extension points from the compiler. Or maybe we can suggest ways that you could use macros as your user API like async and effectful [1].
Also note that CPS has been effectively unmaintained for about 2 years now:src/continuations/plugin/ was touched by about 50 commits in that period.
I agree completely with Jason. If you're using CPS in production and would like support,
please get in touch and we'll try to work something out.
Our experience has been that users of the continuations plugin have been eager to move to scala-async.
Our experience has been that users of the continuations plugin have been eager to move to scala-async.I will investigate scala async. I'm curious though, does it allow you to serialize the "state" of some code and transmit it across the network (ie. a "portable continuation")?
I'll let Jason fill in the gaps in my understanding,but I believe scala-async uses a state machine translation,because it doesn't require the full generality of the cps transform.(It does do an ANF transform, so I'm sure there's potential for code reuse.)
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
just to add my 2 cents, I think an unfortunate decision was made to focus development effort on something less powerful, less expressive (async) instead of investing resources to fix continuations once and for all. Most of the issues like error messages etc. would be easily fixed by integrating the CPS logic into the compiler proper. Making the underlying monad implementation swappable would have made it trivial to add a state-machine implementation as a special case.
This thread reads like a who's who of people working on interesting things, so I'm sure we're sorry to disappoint. (Not that I was involved in the decision - I would have done it years ago.) But you guys have no idea what a burden the implementation is. There's still plenty of very basic stuff in the compiler which doesn't work. By very basic I mean things which affect everyone. This thread notwithstanding, the usage of continuations is tiny. There is no justification available for pouring time into the continuations plugin under those circumstances. And it just being there at all, even if we make absolutely no effort to improve it, is still PLENTY of burden.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
However, I can't agree that there is no justification. I think the justification is that Scala is a platform, and one of the greatest responsibilities of a platform is not to make people regret building on it by removing features that have no alternative, as is the case with the CPS plugin.
I think it would be good to re-think the approach to continuations. Async has two important advantages over the CPS plugin:
1) It's a macro, and a blackbox macro to boot, so we can assume the compiler will support it in the future. The cps plugin is a compiler plugin, and these tend require a much higher amount of maintenance to keep them in sync with future compiler versions.2) It's syntactic, triggered by async/await wrappers. This makes it much easier to disentangle from the compiler internals. By contrast, the cps plugin requires fairly tricky integration of annotation checkers in the type checker. A lot of that code was written specifically for the continuations plugin (and a couple other, more experimental ones). Many of us believe that we have not yet discovered all the possible corner cases in this integration.But of course, continuations subsume async and are much more powerful. So one potentially interesting question for potential contributors would be:- can one implement cps transform as a macro as opposed to a compiler plugin?- can the source language itself be syntactic, prompted by wrapper calls instead of annotations?
It's obvious that these are advantages in terms of making life easier for the compiler team. Whether they are advantages for Scala users seems debatable.
Not to mention that Akka (at least at one point? still?), used the plugin to support
dataflow concurrency.
I said that as one of the people who has built async-like
functionality on top of the CPS plugin (several people have done it
independently). I know from first hand experience that given Tiark's
work 90% of the rest is pretty close to trivial. The last last 10%,
maybe not so trivial, but whether that's "not obviously" or "obviously
not" less effort than rehashing the hard bit (ie. the CPS transform,
even leaving out the effect typing) probably only Tiark can judge. My
gut feeling is that the wrong call was made.
that isn't using the CPS plugin. Availability bias may make this hard to believe,but I'd be shocked to see more than 1% of Scala developers using the plugin.
It's the cps plugin itself that's causing head aches, not the plugin infrastructure.We won't deprecate the plugin infrastructure in 2.11, so it'll at least be around until 2.12.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Greg,The for comprehension syntax desugaring happens during parser, both in plain and virtualized scala (last I checked, anyway),so I don't think that would help you.
Dear Paolo,Thanks!Basically, i want access to the for-comprehension before it is de-sugared in order to do syntactic analysis that will result in slightly different de-sugaring patterns depending on what's encountered. In our domainfor( ptn <- src if cond( ptn ) ) yield { e }we need to determine what of cond and e can be sent to compilation for native storage processing and what must be done in memory. A very large chunk of this can be done syntactically.
SébastienCheers,I also have but two weeks ago figured out that the CPS plugin was the solution to a difficult design issue I had in one of my personal projects. That project cross-compiles under Scala and Scala.js, and in JavaScript you don't have threads. CPS is the only solution I found to design the project in a sane way, considering the 1-thread-only limitation. Btw, yes, the CPS plugin works with Scala.js!Hi all,I really hope some CPS plugin will continue to exist. Async is a better, nicer solution under the assumption of lexical scoping. But capturing the full state of a thread across library boundaries is sometimes very useful, and only the CPS plugin provides that.
On Thu, Aug 22, 2013 at 9:45 AM, Philipp Haller <hal...@gmail.com> wrote:
Hi Greg,This sounds very interesting!On Wed, Aug 21, 2013 at 9:18 PM, Adriaan Moors <adriaa...@typesafe.com> wrote:
I'll let Jason fill in the gaps in my understanding,but I believe scala-async uses a state machine translation,because it doesn't require the full generality of the cps transform.(It does do an ANF transform, so I'm sure there's potential for code reuse.)
Exactly.The Async SIP [1] contains a fully worked-out example of both the ANF transform and the state machine translation. To compare with the CPS plugin, we have a number of tests [2] that show what the current restrictions of Async are.
Cheers,PhilippOn Wed, Aug 21, 2013 at 11:53 AM, Meredith Gregory <lgreg.m...@gmail.com> wrote:
Dear Adriaan, and All,Thanks for all the helpful information!Biosimilarity, LCC (Biosim), my company, had already concluded that we needed to own our own version of the CPS plugin. After deploying a production level project that used the plugin we realized that there were several desiderata in the plugin and the way we used it that we needed to address. We were planning on making it generally available to the community once we'd gotten it to the point where it was more help than harm. ;-)Biosim would be happy to collaborate with TypeSafe and the community to help craft a CPS solution factored in a way that was flexible enough to support scala-async yet also address users like Swarm and SpecialK -- if that would be of interest.Best wishes,--gregOn Wed, Aug 21, 2013 at 10:48 AM, Adriaan Moors <adriaa...@typesafe.com> wrote:
Hi Ian, Greg,I agree completely with Jason. If you're using CPS in production and would like support,please get in touch and we'll try to work something out.The community is of course more than welcome to maintain the CPS plugin,but we see scala-async as a much, much nicer way of solving these issues.Our experience has been that users of the continuations plugin have been eager to move to scala-async.Also note that CPS has been effectively unmaintained for about 2 years now:src/continuations/plugin/ was touched by about 50 commits in that period.cheersadriaanOn Wed, Aug 21, 2013 at 7:08 AM, Ian Clarke <ian.c...@gmail.com> wrote:
On Wednesday, August 21, 2013 1:55:39 AM UTC-5, Jason Zaugg wrote:With all of this in mind, we have to find a way to communicate our view of CPS to potential new users (we'd rather that *more* projects didn't start depending on it) while providing some sort of migration path for your projects. The plugin could be maintained by a third party, for example, we're not planning to remove the extension points from the compiler. Or maybe we can suggest ways that you could use macros as your user API like async and effectful [1].So long as you are thinking hard about how to avoid leaving existing CPS plugin users high and dry then I feel somewhat better, but I'm curious as to whether macros and async/effectful can offer the functionality we need (effectively serializing the state of a thread transparently to the programmer)?I'm not familiar with Scala macros but will read up on them.Ian.
--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SW
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
So for everyone interested on starting to look into continuations, here is a probably an easy issue to get started: https://groups.google.com/d/topic/scala-internals/ZW_kunE7kiA/discussion
I think adding tests and having a better documentation about what works and which limitations exist would also be a nice starting point.
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to a topic in the Google Groups "scala-internals" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scala-internals/9Ts3GLsXuOg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scala-interna...@googlegroups.com.
I've been told by knowledgeable people that it is impossible to implement composable continuations (AKA delimited continuations AKA shift/reset) in terms of call-with-current-continuation. Since I don't yet understand why that is, I figured it would help my understanding to attempt it and see how it fails.
I'm mostly curious about what tests we could add to
ComposableContinuations.java which will fail using this implementation.
There's nothing like a concrete, failing test to focus the mind.
call/cc implements shift? A good question" here:shift
in terms of call/cc then leads to confusion because the implementation no
longer confirms to the semantics of shift. We demonstrate two simple
counter-examples of the difference between the predicted, on the basis of
the semantics of shift, results and the observed ones.""The problem arises precisely because call/cc captures the whole continuation rather than its prefix.
Such a behavior of call/cc is not a problem
within the POPL94 framework since it
presupposes that shiftis the only effect (with all others
implemented in terms of it). Even call/cc cannot be used except for
its appearance in the implementation of shift. In practice,
effectful operations such as exceptions or dynamic binding are
implemented independently, breaking the main assumption of POPL94 and
exposing the problem of capturing the whole continuation. In these
practical circumstances, call/cc does not implement shift or other
control features. They have to be provided as primitives..." (etc.)
--
You received this message because you are subscribed to the Google Groups "scala-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-interna...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.