Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64326 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 174 invoked from network); 17 Dec 2012 22:11:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Dec 2012 22:11:39 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.155 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.155 smtp155.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.155] ([67.192.241.155:57841] helo=smtp155.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/10-33799-9989FC05 for ; Mon, 17 Dec 2012 17:11:38 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp32.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 9BD3750184; Mon, 17 Dec 2012 17:03:10 -0500 (EST) X-Virus-Scanned: OK Received: by smtp32.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 4ED2B501D5; Mon, 17 Dec 2012 17:03:10 -0500 (EST) Message-ID: <50CF969D.8090707@sugarcrm.com> Date: Mon, 17 Dec 2012 14:03:09 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Nikita Popov CC: PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Adding Generator::throw() From: smalyshev@sugarcrm.com (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 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