in reply to Re: RFC: Simulating Ruby's "yield" and "blocks" in Perl
in thread RFC: Simulating Ruby's "yield" and "blocks" in Perl
But do you agree that this is far from having any syntactic sugar? (rather "syntactic vinegar" ;-)
Just to avoid misunderstandings, Ruby's yield doesn't help creating coroutines!
The functions are executed in one run till the end and the yield are just executions of callbacks given by blocks.
Python OTOH uses yield a statement in so called "generators" to define iterators which freeze their state each time they return with yield.
Much like gather and take in Perl6.
( addicted to the Perl Programming Language)