Forum: Ruby Seeking Continuations Links

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-01 22:30
(Received via mailing list)
Myself and a few others are trying to get together a "Playing Around
with Continuations" project.  As a start, we are collecting any
resources we can find about them.

If you have links to any continuations related material, would you
please reply and post them here.  I will start us off:

General Definition --
   http://en.wikipedia.org/wiki/Continuations

Ruby Based Tutorials --
   http://www.rubygarden.org/ruby?Continuations
   http://www.deepwood.net/~mikael/continuations/

Ruby Examples --
   http://eigenclass.org/hiki.rb?Continuations+are+so...
+grasp+than+2ch

Ruby Projects Using (at least some) Continuations --
   http://rubyforge.org/projects/wee/

Other Languages --
   http://www.intertwingly.net/blog/2005/04/13/Contin...
Curmudgeons

Thanks for any links you can provide.

James Edward Gray II
Cb48ca5059faf7409a5ab3745a964696?d=identicon&s=25 unknown (Guest)
on 2006-02-02 01:00
(Received via mailing list)
On Thu, 2 Feb 2006, James Edward Gray II wrote:

> Ruby Based Tutorials --
> Other Languages --
>  http://www.intertwingly.net/blog/2005/04/13/Contin...
>
> Thanks for any links you can provide.


http://lambda-the-ultimate.org/node/1036

http://www.google.com/search?as_q=continuation&num...


trying to get a headache james?  ;-)

regards.

-a
2cf6d8e639314abd751f83a72e9a2ac5?d=identicon&s=25 Martin DeMello (Guest)
on 2006-02-02 01:21
(Received via mailing list)
James Edward Gray II <james@grayproductions.net> wrote:
> Myself and a few others are trying to get together a "Playing Around
> with Continuations" project.  As a start, we are collecting any
> resources we can find about them.
>
> If you have links to any continuations related material, would you
> please reply and post them here.  I will start us off:

Don't miss the classic "sandwich" post:

http://groups.google.com/group/perl.perl6.language...

martin
32edd0717b3144d5c58a352d613abdc9?d=identicon&s=25 gabriele renzi (Guest)
on 2006-02-02 01:24
(Received via mailing list)
James Edward Gray II ha scritto:

> If you have links to any continuations related material, would you
> please reply and post them here.  I will start us off:

maybe useful:
http://c2.com/cgi/wiki?CallWithCurrentContinuation (and linked)
http://lambda-the-ultimate.org/node/86
http://www.sidhe.org/~dan/blog/archives/000185.html
http://www.madore.org/~david/computers/callcc.html

Also, I have a page in italian about a small part of what Kernel#callc
is.. but I don't think it is worth adding the link :)
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-02-02 02:40
(Received via mailing list)
James Edward Gray II wrote:
> Myself and a few others are trying to get together a "Playing Around
> with Continuations" project.  As a start, we are collecting any
> resources we can find about them.

Is there a an online copy (video, I hope) of the continuations talk by
Jim Weirich and Chad Fowler from RubyConf05?

It was really quite good.


--
James Britt

"Blanket statements are over-rated"
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-02 05:02
(Received via mailing list)
On Feb 1, 2006, at 4:21 PM, ara.t.howard@noaa.gov wrote:

> trying to get a headache james?  ;-)

<laughs>  Probably.

I guess we figured there was safety in numbers, so... well... we
could get headaches together.  :)

Thanks all for the terrific links.

James Edward Gray II
65bd9e4c5aebde25ebf16d599339d570?d=identicon&s=25 Adam Sanderson (Guest)
on 2006-02-02 19:20
(Received via mailing list)
Headaches for all!

I have a feeling that contiuations are an excellent solution for a
problem I haven't found yet.  Though I want to find this problem,
because I have a suspiscion that using continuations to solve it will
make me feel much cooler ;)

  .adam
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-02-02 19:50
(Received via mailing list)
On Feb 1, 2006, at 4:30 PM, James Britt wrote:

>
> --
> James Britt
>
> "Blanket statements are over-rated"
>

Folks-

	The video and audio from rubyconf 05 is still available on my blog:

http://brainspl.at/articles/2005/12/01/rubyconf-fi...

	And the Weirich and Fowler contibuations movie is here:

http://yhrhosting.com/rubyconf/FowlerAndWeirich240S.mov


Enjoy!
-Ezra
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-02 23:55
(Received via mailing list)
On Feb 2, 2006, at 12:48 PM, Ezra Zygmuntowicz wrote:

> Folks-
>
> 	The video and audio from rubyconf 05 is still available on my blog:
>
> http://brainspl.at/articles/2005/12/01/rubyconf-fi...
>
> 	And the Weirich and Fowler contibuations movie is here:
>
> http://yhrhosting.com/rubyconf/FowlerAndWeirich240S.mov

Are the unit tests from this talk, like when they implemented catch/
throw, available anywhere?

James Edward Gray II
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-02-03 00:01
(Received via mailing list)
On 2/2/06, James Edward Gray II <james@grayproductions.net> wrote:
> > http://yhrhosting.com/rubyconf/FowlerAndWeirich240S.mov
>
> Are the unit tests from this talk, like when they implemented catch/
> throw, available anywhere?

Yep:
http://onestepback.org/articles/callcc/throw_catch/

I had the pleasure of attending that workshop. Very cool.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-02-03 20:17
(Received via mailing list)
On Feb 2, 2006, at 4:59 PM, Wilson Bilkovich wrote:

> Yep:
> http://onestepback.org/articles/callcc/throw_catch/
>
> I had the pleasure of attending that workshop. Very cool.

Wow, thank you.  Trickiest 27 lines of code I ever wrote.  :)

James Edward Gray II
567898c496278341be69087507d5ed24?d=identicon&s=25 Jeff Rose (Guest)
on 2006-02-07 14:33
(Received via mailing list)
On 2/1/06, James Edward Gray II <james@grayproductions.net> wrote:
>
> Myself and a few others are trying to get together a "Playing Around
> with Continuations" project.  As a start, we are collecting any
> resources we can find about them.
>

I don't have a link, but last night a buddy and I found a cool usage for
continuations and AOP in implementing a network simulator.  The general
idea
might work for testing drb code as well, although we haven't gone that
far
yet.

Our simulator is a typical discrete event based simulator, and
previously we
had been using messages (packets) to communicate between virtual nodes
in
the network.  For our current project we wanted to implement a p2p
algorithm
in an rpc style though, which seemingly would require us to implement
proxy
objects for everything that would send messages so it can all go through
the
simulator.  Then we realized that by just wrapping any methods which
should
be treated as "remote" with some message passing code we could possibly
use
the same code for simulation as for an implementation (yet to be
verified on
anything real...).  Either way this saves a lot of time, and after some
initial unit testing it seems to be working correctly.  Here is the
wrapper
method, which hopefully shows how it is working: (It's shorter than it
looks. Mostly just comments so a couple months down the line these
continuations don't require another neural re-wiring :-)

----------------------------------
module GoSim
  module Net
    # Wrap the methods of a class so they are called through the
    # network simulator.
    def Net.remote_method(clazz, *methods)
      methods.each do |meth|

        # Store the original method so we can call it eventually.
        original = clazz.instance_method(meth)
        clazz.instance_eval do

          # Define a new method with the same name, which sends
          # a message on the call and then another on the return.
          define_method(meth) do |*a|

            # Save a continuation to return to this point when the
            # event fires at a later time.
            cont = nil
            from_sched = callcc {|cont|}

            # Post the message event and jump back into the
            # event scheduling loop. Note that from_sched will be
            # true when the continuation is called later.
            GoSim::Net::Topology.instance.
              transmit_continuation(cont) unless from_sched

            # Make the actual method call
            retval = original.bind(self).call(*a)

            # Now do it over again for the return value.
            cont = nil
            ret = callcc {|cont|}
            GoSim::Net::Topology.instance.
              transmit_continuation(cont) if ret.nil?

            retval
          end
        end
      end
    end # def remote_method
  end # Net
end # GoSim
----------------------------------
Make sense?  Think this could work to simulate a bunch of drb objects
communicating with each other?  Could be a handy way to unit test
distributed applications etc...

-Jeff
This topic is locked and can not be replied to.