Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2134 invoked from network); 24 Dec 2012 05:03:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Dec 2012 05:03:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.54 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.160.54 mail-pb0-f54.google.com Received: from [209.85.160.54] ([209.85.160.54:49382] helo=mail-pb0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/56-32426-D12E7D05 for ; Mon, 24 Dec 2012 00:03:26 -0500 Received: by mail-pb0-f54.google.com with SMTP id wz12so3769487pbc.27 for ; Sun, 23 Dec 2012 21:03:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=qcA/nabp1OWFAPwdPxnVrgmpOmA0uUuHspAGtmjx1yY=; b=IBBNIlDkwZ72Kd2sDCAz1x0/7s4P0uQrvszdwRmtYxrifNDFrk3snSSo7o8QkWuDzo /6TZoxFaP2q+H+fOweSCZDfMexpsf7RgMs9Cw3UKYFwEvfD4rb1QPB66GNy1xbxotjoE 4aGzigT7F79dGfigBxcL6AHdzE+uYIWuJpuIpTkwqsx+Ocd16N9SYg22DrGLNvdCgz+W Mla/Mi8M0O4DWnnBirPTedeiicBa5Z7Cj1kwSTHASj28nZDcFWLWjkG+nLQSkFQcX9QJ Wv+xp6FOXu2Q9gGW4B61LYj1/4SFR8nxoHpC/rctEqJTiYGmy+TGT4M10dS3T8Pyd+1n deQA== MIME-Version: 1.0 Received: by 10.68.241.232 with SMTP id wl8mr63266857pbc.144.1356325403185; Sun, 23 Dec 2012 21:03:23 -0800 (PST) Sender: tjerk.meesters@gmail.com Received: by 10.66.86.3 with HTTP; Sun, 23 Dec 2012 21:03:22 -0800 (PST) In-Reply-To: <50CF969D.8090707@sugarcrm.com> References: <50CF969D.8090707@sugarcrm.com> Date: Mon, 24 Dec 2012 13:03:22 +0800 X-Google-Sender-Auth: hARRyKAuS_NMKnW-HXMRVGtqP3A Message-ID: To: Stas Malyshev Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=047d7b339bf5db53be04d1921dee Subject: Re: [PHP-DEV] Adding Generator::throw() From: datibbaw@php.net (Tjerk Anne Meesters) --047d7b339bf5db53be04d1921dee Content-Type: text/plain; charset=ISO-8859-1 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 > > 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. > 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 bad use cases that are implicitly referred to when saying this? If not, then perhaps my understanding of exceptions needs a spring cleaning :) > > > 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 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Tjerk --047d7b339bf5db53be04d1921dee--