in reply to Re: Perl 6 coroutines (RFC 31)
in thread Perl 6 coroutines (RFC 31)

I think that Damian's proposal assumes that Perl is going to maintain a global stack, and what is saved is just the internal state of the function. Then $_, being a global, will be whatever it is currently in Perl while where you start in the block will be preserved.
  • Comment on Re (tilly) 1: Perl 6 coroutines (RFC 31)

Replies are listed 'Best First'.
Re: Re (tilly) 1: Perl 6 coroutines (RFC 31)
by MeowChow (Vicar) on Jul 15, 2001 at 02:15 UTC
    I believe that would create alot of nasty confusion, and make localized globals all but useless inside of coroutines. For instance, the following would be quite troublesome:
    sub my_iter { for (@_) { yield $_; # upon return, $_ may no longer be localized. if we # modify it, we could be modifying a global value # outside our scope. there's no way to tell, and # that's rather nasty. } }
    Of course, one could avoid using localized globals inside coroutines/generators in the first place, but where's the fun in that, I ask ;)
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print