develooper Front page | perl.perl6.language | Postings from April 2008

Are coroutines still there?

Thread Next
From:
TSa
Date:
April 18, 2008 10:22
Subject:
Are coroutines still there?
HaloO,

I just wonder what has become of the coroutine feature.
Was that dropped from the spec? And when yes, why?
The trick is to design the yield statement nicely.
And also to define a syntax that allows to get a fresh
instance from a coro quasi-class.

   sub foo () { my $x = 0; yield $x++; }

   &f = &foo.new; # or also foo.new?

   say f(); # 0
   say f(); # 1
   say f(); # 2

Regards, TSa.
-- 

"The unavoidable price of reliability is simplicity"
   -- C.A.R. Hoare

Thread Next


Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About