[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl6-language
Subject:    Re: New parrot feature: reset coros, or not? how to deal with dead coros
From:       "Michael Zedeler." <michael () zedeler ! dk>
Date:       2014-10-15 16:52:38
Message-ID: 543EA656.8070906 () zedeler ! dk
[Download RAW message or body]

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
michael@zedeler.dk <mailto:michael@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/>

[Attachment #3 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Reini.<br>
      <br>
      On 2014-10-15 16:21, Reini Urban wrote:<br>
    </div>
    <blockquote
cite="mid:CAHiT=DFA6f98ifzZSdBr9PbsWuty63crTZTpYyq=z+E5ujfDdQ@mail.gmail.com"
      type="cite">
      <pre wrap="">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
?
</pre>
    </blockquote>
    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.<br>
    <br>
    Written by a seasoned user of a fair amount of programming
    languages.<br>
    <div class="moz-signature">-- <br>
      Michael Zedeler<br>
      70 25 19 99<br>
      <a href="mailto:michael@zedeler.dk">michael@zedeler.dk</a><br>
      <br>
      <a href="http://dk.linkedin.com/in/mzedeler/">dk.linkedin.com/in/mzedeler</a>
      | <a href="https://twitter.com/mzedeler">twitter.com/mzedeler</a>
      | <a href="https://github.com/mzedeler/">github.com/mzedeler</a>
    </div>
  </body>
</html>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic