Re: Cothreads [Philosophy]

2003-05-29 Thread Michael Lazzaro
On Tuesday, May 27, 2003, at 07:32 PM, Jonathan Scott Duff wrote: On Tue, May 27, 2003 at 02:05:57PM -0700, Michael Lazzaro wrote: If we could think about threads not in terms of forkyness, but simply in terms of coroutines that can be called in parallel, it should be possible to create an

Re: Cothreads [Philosophy]

2003-05-29 Thread Austin Hastings
--- Michael Lazzaro [EMAIL PROTECTED] wrote: How, then, would you design an interface around (Concept 1) -- the listener/eventloop/subprocess model? Pseudocode for a top-level event loop might be something like: loop { sleep($fraction), next unless $e =

Re: Cothreads [Philosophy]

2003-05-29 Thread Dave Whipp
Austin Hastings [EMAIL PROTECTED] wrote: 1. Cyield always acts the same way -- stores args in CurThread.result and gives up control to [?something?]. I think you want a fifo on the output there -- at least conceptually. Stores args in .result might overly block the producer thread. gives up

Re: Cothreads [Philosophy]

2003-05-29 Thread Dulcimer
You may evaluate for yourself whether thse comments are actually worth two cents, but: I want to be able to tell whether my program is threading or using some other useful-but-not-what-I'd-do-in-a-hurry tool. I don't want to learn a thousand different details that are only there to make sure I

Re: Cothreads [Philosophy]

2003-05-29 Thread Austin Hastings
--- Dave Whipp [EMAIL PROTECTED] wrote: Austin Hastings [EMAIL PROTECTED] wrote: 1. Cyield always acts the same way -- stores args in CurThread.result and gives up control to [?something?]. I think you want a fifo on the output there -- at least conceptually. Stores args in .result

Re: Cothreads [Philosophy]

2003-05-29 Thread Michael Lazzaro
On Wednesday, May 28, 2003, at 01:01 PM, Austin Hastings wrote: Exampling: sub traverse(Hash $tree) { return unless $tree; traverse $tree{left} if $tree{left}; yield $tree{node}; traverse $tree{right} if $tree{right}; } my %hash is Tree; my cotrav := coro traverse(%hash); print $_ for

Re: Cothreads [Philosophy]

2003-05-29 Thread Austin Hastings
--- Michael Lazzaro [EMAIL PROTECTED] wrote: On Wednesday, May 28, 2003, at 01:01 PM, Austin Hastings wrote: Exampling: sub traverse(Hash $tree) { return unless $tree; traverse $tree{left} if $tree{left}; yield $tree{node}; traverse $tree{right} if $tree{right}; }

Re: Cothreads [Philosophy]

2003-05-29 Thread Luke Palmer
But, as Luke pointed out, some of the other syntax required to make that work is isn't particularly friendly: coro pre_traverse(%data) { yield %data{ value }; yield $_ for _.clone(%data{ left }); yield $_ for _.clone(%data{ right }); } If I work

Re: Cothreads [Philosophy]

2003-05-29 Thread Luke Palmer
--- Michael Lazzaro [EMAIL PROTECTED] wrote: On Wednesday, May 28, 2003, at 01:01 PM, Austin Hastings wrote: Exampling: sub traverse(Hash $tree) { return unless $tree; traverse $tree{left} if $tree{left}; yield $tree{node}; traverse $tree{right} if

Re: Cothreads [Philosophy]

2003-05-29 Thread Dave Whipp
Austin Hastings [EMAIL PROTECTED] wrote --- Dave Whipp [EMAIL PROTECTED] wrote: Austin Hastings [EMAIL PROTECTED] wrote: 1. Cyield always acts the same way -- stores args in CurThread.result and gives up control to [?something?]. I think you want a fifo on the output there -- at

Re: Cothreads [Philosophy]

2003-05-29 Thread Michael Lazzaro
On Wednesday, May 28, 2003, at 02:56 PM, Austin Hastings wrote: (s/coroutine/thread/g for the same rough arguments, e.g. why should the caller care if what they're doing invokes parallelization, so long as it does the right thing?) Global variables. Threads __never__ do the right thing. Heh.

Re: Cothreads [Philosophy]

2003-05-29 Thread Dave Whipp
Michael Lazzaro [EMAIL PROTECTED] wrote in for foo() {...} It doesn't matter whether foo() is a closure or function returning a list, lazy list, or iterator, or is a coroutine returning it's .next value. Which is excellent, and, I'd argue, the whole point; I'm not sure that we can have