Re: [PHP-DEV] Adding Generator::throw()

2012-12-25 Thread Stas Malyshev
Hi! > I've been hearing this argument from time to time and I don't understand > it; aren't exceptions created with the sole purpose of (error) flow control? No. Exceptions are meant for something that "should never happen". I.e., if your application reads its config files and they are not there,

Re: [PHP-DEV] Adding Generator::throw()

2012-12-24 Thread Anthony Ferrara
Tjerk, I've been hearing this argument from time to time and I don't understand > it; aren't exceptions created with the sole purpose of (error) flow > control? > > If so, then how can "exceptions for flow control" and "very bad idea" be > mentioned in the same sentence unless there are particular

Re: [PHP-DEV] Adding Generator::throw()

2012-12-23 Thread Tjerk Anne Meesters
Hi, On Tue, Dec 18, 2012 at 6:03 AM, Stas Malyshev wrote: > Hi! > > > Basically the method allows you to do delegate error handling to the > > coroutine, rather than doing it yourself (as you are not always able to > do > > it). It is particularly useful in more complicated settings, e.g. if you

Re: [PHP-DEV] Adding Generator::throw()

2012-12-23 Thread Nikita Popov
On Fri, Dec 21, 2012 at 11:09 PM, Christopher Jones < christopher.jo...@oracle.com> wrote: > > > On 12/21/2012 06:54 AM, Nikita Popov wrote: > >> If there are no further objections I'll commit this tomorrow. >> >> Nikita >> > > This feature needs documenting in Generator RFC before it is committed

Re: [PHP-DEV] Adding Generator::throw()

2012-12-21 Thread Christopher Jones
On 12/21/2012 06:54 AM, Nikita Popov wrote: If there are no further objections I'll commit this tomorrow. Nikita This feature needs documenting in Generator RFC before it is committed. The RFC will be referenced by people new to the feature and so it should have a complete list of changes.

Re: [PHP-DEV] Adding Generator::throw()

2012-12-21 Thread Nikita Popov
On Mon, Dec 17, 2012 at 11:45 PM, Nikita Popov wrote: > On Mon, Dec 17, 2012 at 11:03 PM, Stas Malyshev wrote: > >> Hi! >> >> > Basically the method allows you to do delegate error handling to the >> > coroutine, rather than doing it yourself (as you are not always able to >> do >> > it). It is p

Re: [PHP-DEV] Adding Generator::throw()

2012-12-17 Thread Nikita Popov
On Mon, Dec 17, 2012 at 11:03 PM, Stas Malyshev wrote: > Hi! > > > Basically the method allows you to do delegate error handling to the > > coroutine, rather than doing it yourself (as you are not always able to > do > > it). It is particularly useful in more complicated settings, e.g. if you > >

Re: [PHP-DEV] Adding Generator::throw()

2012-12-17 Thread Stas Malyshev
Hi! > Basically the method allows you to do delegate error handling to the > coroutine, rather than doing it yourself (as you are not always able to do > it). It is particularly useful in more complicated settings, e.g. if you > are doing task scheduling through coroutines. For a small sample of h

[PHP-DEV] Adding Generator::throw()

2012-12-17 Thread Nikita Popov
Hey internals! I would like to add a ->throw() method to generator objects and as this wasn't part of the proposal that was voted on I'd like to ask back first. The Generator::throw(Exception $exception) method takes an exception and throws it at the current interruption point in the generator. I