[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Concerns about removal of continuations in Ruby 2.0

Alder Green

10/31/2006 9:09:00 AM

1. Certain control flow structures rely on continuations:

For instance, Ruby's generator implementation requires them[1].
Generators provide the canonical - most natural and convenient -
solutions for problems as typical as iterating over two or more Arrays
in parallel, simple suspended execution, resumable functions, and
others.


2. Existing 3rd-party packages rely on continuations:

For instance, the very popular and useful ruby-breakpoint package is
designed around continuations.


3. Certain possible features and packages need continuations:

The most obvious example is continuations-based web frameworks like
Seaside. The Ruby community has always been living on the cutting edge
of web technologies. Lack of continuations might prevent Rubyists from
pursuing one of the most interesting recent developments in
web-programming technology.

-Alder

--
[1] http://onestepback.org/articles/sa...

5 Answers

Ross Bamford

10/31/2006 9:29:00 AM

0

On Tue, 2006-10-31 at 18:08 +0900, Alder Green wrote:
> 1. Certain control flow structures rely on continuations:
>
> For instance, Ruby's generator implementation requires them[1].

Not any more - check out generator.rb in 1.9 (though what'll happen if
we lose green threads too, I don't know).

--
Ross Bamford - rosco@roscopeco.REMOVE.co.uk


Yukihiro Matsumoto

10/31/2006 4:14:00 PM

0

Hi,

In message "Re: Concerns about removal of continuations in Ruby 2.0"
on Tue, 31 Oct 2006 18:08:45 +0900, "Alder Green" <alder.green@gmail.com> writes:

|1. Certain control flow structures rely on continuations:
|2. Existing 3rd-party packages rely on continuations:
|3. Certain possible features and packages need continuations:

Yes, yet they are few. What I said were:

* Ruby 1.9.1 will not have continuation, since they have lowest
priority and are difficult to implement efficiently.

* no promise (neither positive nor negative) on continuation for
1.9.2 or 2.0, for exact same reason above.

matz.

Charles Oliver Nutter

10/31/2006 4:32:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Concerns about removal of continuations in Ruby 2.0"
> on Tue, 31 Oct 2006 18:08:45 +0900, "Alder Green" <alder.green@gmail.com> writes:
>
> |1. Certain control flow structures rely on continuations:
> |2. Existing 3rd-party packages rely on continuations:
> |3. Certain possible features and packages need continuations:
>
> Yes, yet they are few. What I said were:
>
> * Ruby 1.9.1 will not have continuation, since they have lowest
> priority and are difficult to implement efficiently.
>
> * no promise (neither positive nor negative) on continuation for
> 1.9.2 or 2.0, for exact same reason above.

From a JRuby perspective, we could support continuations, but with the
same or greater limitations on their utility. With no continuation
support at the VM level, we would need to avoid deepening the Java call
stack to allow continuations to function. This isn't too terribly
difficult to do for pure Ruby code, but quite difficult and a
performance hit for Java code. It's also impossible to do with
third-party libraries involved that aren't designed with microthreading
or stackless execution in mond. There are tools that can microthread
existing code after-the-fact, but that's purely experimental.

Of course I don't believe a language should be developed with platform
limitations in mind, or I'd be using Groovy...but in this case the
difficulty of implementing continuations efficiently, portably, and
correctly with native threads and external libraries involved almost
seems to outweigh their utility. But I'm not a language design maven, so
I will not offer my opinion on whether continuations are a worthwhile
feature. Suffice it to say I haven't seen any *practical* applications
of continuations that couldn't be implemented in a less abstract (but
possibly more verbose) way.

--
Charles Oliver Nutter, JRuby Core Developer
Blogging on Ruby and Java @ headius.blogspot.com
Help spec out Ruby today! @ www.headius.com/rubyspec
headius@headius.com -- charles.nutter@sun.com

Patrick Hurley

10/31/2006 9:36:00 PM

0

On 10/31/06, Charles Oliver Nutter <charles.nutter@sun.com> wrote:
> limitations in mind, or I'd be using Groovy...but in this case the
> difficulty of implementing continuations efficiently, portably, and
> correctly with native threads and external libraries involved almost
> seems to outweigh their utility. But I'm not a language design maven, so
> I will not offer my opinion on whether continuations are a worthwhile
> feature. Suffice it to say I haven't seen any *practical* applications
> of continuations that couldn't be implemented in a less abstract (but
> possibly more verbose) way.

I will agree that they are rarely used (at least in Ruby), but for a
nice use case see wee (http://www.ntecs.de/bl...) or Seeside
(in smalltalk, but more active: http://www.s...).

That being said, Matz's goal of delivering 1.9.1 without continuations
makes sense as they are rarely used in Ruby (possibly due to their
inefficiency and/or the richness of Ruby's existing flow control/block
semantics).

pth

M. Edward (Ed) Borasky

11/2/2006 4:09:00 PM

0

Yukihiro Matsumoto wrote:
> Hi,
>
> In message "Re: Concerns about removal of continuations in Ruby 2.0"
> on Tue, 31 Oct 2006 18:08:45 +0900, "Alder Green" <alder.green@gmail.com> writes:
>
> |1. Certain control flow structures rely on continuations:
> |2. Existing 3rd-party packages rely on continuations:
> |3. Certain possible features and packages need continuations:
>
> Yes, yet they are few. What I said were:
>
> * Ruby 1.9.1 will not have continuation, since they have lowest
> priority and are difficult to implement efficiently.
>
> * no promise (neither positive nor negative) on continuation for
> 1.9.2 or 2.0, for exact same reason above.
>
> matz.
>
>

An old saying in programming language design states that the toughest
part of language design is knowing what to leave out. Given that, if it
is decided to leave continuations out of 1.9.1, perhaps it is wiser to
leave them out "forever", or at least until Ruby 3.0.

Of course, *I* want to see them stay in "forever", so this is all
rhetorical. :)

Incidentally, the Carbone project (Ruby VM using the "vmgen" base) is
indeed inactive -- I asked the developer. I haven't looked at the source
yet, but I just might, given that.