Re: Coroutine Question

2005-05-04 Thread Aaron Sherman
On Wed, 2005-05-04 at 09:47, Joshua Gatcomb wrote: So without asking for S17 in its entirety to be written, is it possible to get a synopsis of how p6 will do coroutines? A coroutine is just a functional unit that can be re-started after a previous return, so I would expect that in Perl, a

Re: Coroutine Question

2005-05-04 Thread Joshua Gatcomb
On 5/4/05, Luke Palmer [EMAIL PROTECTED] wrote: On 5/4/05, Joshua Gatcomb [EMAIL PROTECTED] wrote: So without asking for S17 in its entirety to be written, is it possible to get a synopsis of how p6 will do coroutines? I ask because after reading Dan's What the heck is: a coroutine, it is

Coroutine Question

2005-05-04 Thread Luke Palmer
On 5/4/05, Joshua Gatcomb [EMAIL PROTECTED] wrote: Ok - this isn't what I was expecting at all. That doesn't make it a bad thing. Given something that looks a lot more like a typical coroutine: sub example is coroutine { yield 1; yield 2; yield 3; } I would expect for 1

Re: Coroutine Question

2005-05-04 Thread Ingo Blechschmidt
Hi, Joshua Gatcomb wrote: On 5/4/05, Luke Palmer [EMAIL PROTECTED] wrote: On 5/4/05, Joshua Gatcomb [EMAIL PROTECTED] wrote: So without asking for S17 in its entirety to be written, is it possible to get a synopsis of how p6 will do coroutines? I ask because after reading Dan's What the

Re: Coroutine Question

2005-05-04 Thread Joshua Gatcomb
On 5/4/05, Luke Palmer [EMAIL PROTECTED] wrote: On 5/4/05, Joshua Gatcomb [EMAIL PROTECTED] wrote: Ok - this isn't what I was expecting at all. That doesn't make it a bad thing. Given something that looks a lot more like a typical coroutine: sub example is coroutine { yield 1;

Re: Coroutine Question

2005-05-04 Thread Aaron Sherman
On Wed, 2005-05-04 at 10:07, Aaron Sherman wrote: On Wed, 2005-05-04 at 09:47, Joshua Gatcomb wrote: So without asking for S17 in its entirety to be written, is it possible to get a synopsis of how p6 will do coroutines? A coroutine is just a functional unit that can be re-started after

Re: Coroutine Question

2005-05-04 Thread John Macdonald
On Wed, May 04, 2005 at 10:43:22AM -0400, Aaron Sherman wrote: On Wed, 2005-05-04 at 10:07, Aaron Sherman wrote: On Wed, 2005-05-04 at 09:47, Joshua Gatcomb wrote: So without asking for S17 in its entirety to be written, is it possible to get a synopsis of how p6 will do coroutines?

Re: Coroutine Question

2005-05-04 Thread Patrick R. Michaud
On Wed, May 04, 2005 at 02:22:43PM -0400, John Macdonald wrote: On Wed, May 04, 2005 at 10:43:22AM -0400, Aaron Sherman wrote: On Wed, 2005-05-04 at 10:07, Aaron Sherman wrote: A coroutine is just a functional unit that can be re-started after a previous return, so I would expect that in

Re: Coroutine Question

2005-05-04 Thread Rod Adams
John Macdonald wrote: The most common (and what people sometimes believe the *only* usage) is as a generator - a coroutime which creates a sequence of values as its chunk and always returns control to its caller. (This retains part of the subordinate aspect of a subroutine. While it has the

Re: Coroutine Question

2005-05-04 Thread Damian Conway
[Not back, just sufficiently irritated...] Luke Palmer wrote: in my proposal, when you call a coroutine, it returns an iterator (and doesn't call anything): my $example = example(); =$example; # 1 =$example; # 2 The thing this buys over the traditional (which I refer to as the

Re: Coroutine Question

2005-05-04 Thread John Macdonald
On Wed, May 04, 2005 at 03:02:41PM -0500, Rod Adams wrote: John Macdonald wrote: The most common (and what people sometimes believe the *only* usage) is as a generator - a coroutime which creates a sequence of values as its chunk and always returns control to its caller. (This retains part

Re: Coroutine Question

2005-05-04 Thread Damian Conway
John Macdonald wrote a lovely summary of coroutines [omitted]. Then added: I'd use resume instead of coreturn We've generally said we'd be using yield. and the interface for resume would allow values to be sent in as well as out. Indeed. As John suggested, the yield keyword (or whatever we call

Re: Coroutine Question

2005-05-04 Thread Rod Adams
John Macdonald wrote: On Wed, May 04, 2005 at 03:02:41PM -0500, Rod Adams wrote: If there are good uses for coroutines that given/take does not address, I'll gladly change my opinion. But I'd like to see some examples. FWIW, I believe that Patrick's example of the PGE returning matches could

Re: Coroutine Question

2005-05-04 Thread John Macdonald
On May 4, 2005 06:22 pm, Rod Adams wrote: John Macdonald wrote: On Wed, May 04, 2005 at 03:02:41PM -0500, Rod Adams wrote: If there are good uses for coroutines that given/take does not address, I'll gladly change my opinion. But I'd like to see some examples. FWIW, I believe that