Hi Reini.
On 2014-10-15 16:21, Reini Urban wrote:
Current parrot behaviour for exhausted yields is dying with "Cannot
resume dead coroutine."
parrot coros are designed after lua, but lua does return nil and as
2nd return value announces also "cannot resume dead coroutine". most
lisp's also behave the same way.
As third version the parrot book announced coros to be auto-resetting.
This makes no sense to me at all, as coros are usually needed to fetch
elements from a lazy list, and when the list is exhausted the state
should return to the head of the list automatically? lazy cycling a la
?
No auto-reset, please. Just return nil or throw an exception. In other
words, make it easy to understand that the coro has been exhausted. It
should be next to trivial to reset back to the initial state. The need
to automatically reset to initial state is unusual, so don't make it the
default.
Written by a seasoned user of a fair amount of programming languages.
--
Michael Zedeler
70 25 19 99
mich...@zedeler.dk <mailto:mich...@zedeler.dk>
dk.linkedin.com/in/mzedeler <http://dk.linkedin.com/in/mzedeler/> |
twitter.com/mzedeler <https://twitter.com/mzedeler> |
github.com/mzedeler <https://github.com/mzedeler/>