Hi Aaron,
Nice stuff! This would be one of killer features of Scala+GWT. :-)
I don't know that much about CPS transform (yet) but I'm guessing it
occurs early enough. We can verify that by running scalac on your
example with -Xshow-phases. If you post the output of that option I'll
tell you more.
Also, it's worth mentioning that I got myself back to project lately
after a long period of being busy with my school projects/exams. I'm
trying to find out how far we are from having Showcase running.
Oh, and on 4th of July I'll be moving to Lausanne and joining
Typesafe. I'll be working on Scala+GWT full-time again.
--
Grzegorz Kossakowski
I don't know that much about CPS transform (yet) but I'm guessing it
occurs early enough. We can verify that by running scalac on your
example with -Xshow-phases. If you post the output of that option I'll
tell you more.
Also, it's worth mentioning that I got myself back to project lately
after a long period of being busy with my school projects/exams. I'm
trying to find out how far we are from having Showcase running.
Oh, and on 4th of July I'll be moving to Lausanne and joining
Typesafe. I'll be working on Scala+GWT full-time again.
Thanks for that list. Yes, jribble backend runs right after cleanup
which is really late in the pipeline. It means that, in principle, CPS
should work just fine and should be completely transparent to jribble
backend. It's hard to verify this hypothesis at the moment because we
are using outdated (one year old) fork of scalac. It's on my roadmap
to perform an update but this will happen in late June.
> Excellent! I noticed (while working on this Async code) that Showcase
> doesn't exercise GWT RPC. It may be worthwhile, as an intermediate
> milestone, to get a small app running that exercises a wider range of GWT's
> features (Showcase is focused on UI, I think).
Yep, Showcase uses lots of UI features of GWT. Isn't it that GWT RPC
heavily depends on Generators?
If you could come up with some more sophisticated app than our hello
world smaller (in terms of code and used features) than Showcase that
would be perfect. It would make my work much easier.
>> Oh, and on 4th of July I'll be moving to Lausanne and joining
>> Typesafe. I'll be working on Scala+GWT full-time again.
>
> That's great news! I'm a little jealous. :-)
Thanks :-)
Actually, I should clarify that I'm joining those guys as an intern
not full-timer. Still, I'll have a pleasure to work with a lot of
great people. :-)
--
Grzegorz Kossakowski
However, be careful about the choice of application. Synchronous RPC
is a dragon with many skeletons in front of its cave. It's been many
times tried but never successfully.
http://labs.oracle.com/techrep/1994/smli_tr-94-29.pdf (a real classic)
http://blog.lexspoon.org/2010/06/evidence-from-successful-usage.html
http://blog.lexspoon.org/2009/01/method-calls-should-be-immediate.html
http://code.google.com/webtoolkit/doc/1.6/DevGuideServerCommunication.html#DevGuideGettingUsedToAsyncCalls
There are other uses of continuations, however. For example, they
enable coroutines....
Lex Spoon
There are other applications than sync RPC, however! For example,
continuations should be very helpful in getting actors to work in a
browser....
Lex
Lex Spoon
> The async call appears synchronous *by default* from the point of view of
> code inside the asynchronously block, but there's a critical distinction
> from synchronous RPC: the developer can always make the call return
> immediately, just by wrapping it in another asynchronously block. Because
> all of the calls are actually asynchronous, the developer has
> fine-grained
> control over where his code will appear to block.
I have to side with Aaron on this matter. The trick is here that the
continuations are delimited, allowing the developer to use blocks of
apparent synchrony to improve readability, while allowing code outside the
blocks to proceed asynchronously. As I see, there is not much difference
between callbacks, and the parts of an "asynchronously" block after the
"blocking" call. Am I right? (I never used delimited continuations before)
It seems to me that this is more like a syntactic sugar for callbacks than
real blocking RPC.
I think this style can be useful if the client code has long, linear
conversations. In these cases asynchronous code ends up with a lot of
state management. With delimited continuations this state management is
provided by the compiler when executing the continuations transformation
phase. Again, I have a limited understanding of the continuations plugin,
so I am happy to hear any corrections.
You give two main arguments.
First, there is the argument that programmers only have to worry about
methods marked CPS-able. However, that sounds to me like saying that
programmers don't have problems if they don't use the facility very
much. If a substantial number of methods are marked as CPS-able, then
any call to any of those methods must be written extra carefully
compared to a system without the facility.
Second, there is an argument that programmers can defend against any
one call blocking by wrapping it in an asynchronously block. However,
the problem is not in dealing with any one method call possibly
blocking. The problem is that *lots* of method calls might block.
Lex Spoon
On Sat, May 28, 2011 at 3:29 PM, Aaron NovstrupYou give two main arguments.
<aaron.n...@gmail.com> wrote:
> I very much appreciate the feedback, and I certainly don't want to waste my
> efforts. My sense at this point is that this approach is sufficiently
> different from synchronous RPC to warrant further investigation, but I'd
> value any further input on that point. What did you think about the
> arguments I laid out in the last email?
First, there is the argument that programmers only have to worry about
methods marked CPS-able. However, that sounds to me like saying that
programmers don't have problems if they don't use the facility very
much. If a substantial number of methods are marked as CPS-able, then
any call to any of those methods must be written extra carefully
compared to a system without the facility.
Second, there is an argument that programmers can defend against any
one call blocking by wrapping it in an asynchronously block. However,
the problem is not in dealing with any one method call possibly
blocking. The problem is that *lots* of method calls might block.
I have to side with Aaron on this matter. The trick is here that the continuations are delimited, allowing the developer to use blocks of apparent synchrony to improve readability, while allowing code outside the blocks to proceed asynchronously. As I see, there is not much difference between callbacks, and the parts of an "asynchronously" block after the "blocking" call. Am I right? (I never used delimited continuations before) It seems to me that this is more like a syntactic sugar for callbacks than real blocking RPC.
Synchronous RPC
is a dragon with many skeletons in front of its cave. It's been many
times tried but never successfully.
http://labs.oracle.com/techrep/1994/smli_tr-94-29.pdf (a real classic)
2011/5/27 Aaron Novstrup <aaron.n...@gmail.com>:
What do you think about using scala-gwt-dlx[1] as a test app? It's quite small, exercises GWT RPC, and already has a Scala backend.
It looks a lot like F# async workflows - useful stuff.
http://blogs.msdn.com/b/dsyme/archive/2007/10/11/introducing-f-asynchronous-workflows.aspx
--
James Moore
ja...@restphone.com
http://blog.restphone.com/