From: grady@... (Steven Grady) Date: 2001-12-20T07:08:03+09:00 Subject: [ruby-talk:29000] Continuations, Procs, Methods, etc. Based on a discussion on another list, I was thinking about continuations recently. One of the interesting (i.e. brainmelt) examples of continuations in Scheme is: (callcc callcc). I was trying to figure out how to express this in Ruby. You can't say: callcc {|cc| callcc(cc)} because the inner callcc isn't allowed to take a continuation as an argument -- it wants a block (it won't even take a Proc). This leads me to my first question: Can the equivalent of (callcc callc) be expressed in Ruby? How about the super-brainmelt: ((callcc callcc) (callcc callcc))? The reason that it's so easy in scheme is that continuations basically are like lambda expressions taking one argument. It would be nice if the things "like lambda expressions" in Ruby, i.e. blocks, Procs, Methods, and Continuations, all behaved the same way. Instead, they are all different: continuations require a block; Procs and Methods have the #arity method, but Continuations don't, etc. So my second question is: Is there any reason for this? Would the language be cleaner if there were a closer relationship between these items (e.g. if they all inherited from Proc)? -- Steven "Don't mess with a man with a wayback machine, Dave, I could make it so that you were never born."