On Wed, 26 Nov 2003, Mathieu Bouchard wrote:
> On Mon, 24 Nov 2003, T. Onoma wrote:
> 
> > Take the def statement for example, why the odd sugar?: def
> > blocky(x,y,&z).  why not def blocky(x,y){z}? But then & isn't exactly
> > just sugar. Is it?

Further comment: on page 14 of Pickaxe, the footnote claims that Ruby's
blocks should be considered as coroutines. I hadn't noticed that note
before, and frankly, I have to say that I don't see how Ruby blocks are
coroutines, as they do all that closures do, but they don't do anything
that coroutines do.

In coroutines, you wouldn't return from a block, you would merely "yield
back", that is, roughly like a return, except that you can actually resume
later, which also smells like a thread switch with a value being passed
across. I mean coroutines are conceptually closer to threads than to
closures. IIRC Python's iterators are more like coroutines, and IIRC
there's an add-on for Ruby that introduces a second kind of iterator that
works more like coroutines.

So I find that note in PickAxe to be rather confusing/perplexing.

________________________________________________________________
Mathieu Bouchard                       http://artengine.ca/matju