Re: Adding Generator::throw()

From: Date: Mon, 17 Dec 2012 22:03:09 +0000
Subject: Re: Adding Generator::throw()
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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 how

Could you expand on this point a bit more? It sounds like using
exceptions for flow control, which is usually a very bad idea.

> this looks like see http://taskjs.org/. What the ->throw()
> method would do
> in these examples is that it allows to check for errors by try/catching the
> yield statement (rather than going for some odd solution with error
> callbacks).

Could you point to some specific example?

-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227


Thread (9 messages)

« previous php.internals (#64326) next »