Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62646 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 94297 invoked from network); 2 Sep 2012 01:07:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2012 01:07:21 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.170 mail-vc0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:60555] helo=mail-vc0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/DC-17065-641B2405 for ; Sat, 01 Sep 2012 21:07:20 -0400 Received: by vcbgb30 with SMTP id gb30so4908348vcb.29 for ; Sat, 01 Sep 2012 18:07:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=M2IGOSrh1DevOBkUISxfUvvmUc0KfrjCKl3ebWJqogY=; b=GrvZAamkouYqbRC7t49B/VnyrzqeFJJJBonkR5JWi/pB7tvOvnO/+WYqQKPsv5YlqM /2Mi9GlafA7nrcZt5ed1z9sN/6a72/2aYi/HI+DMv+6UDQoMtNr99NsnOCMS46oVZrD5 A+cl3oFf64BfK00awrJcJsrn70/PDuMt3e9bhqiHTgoyYcyIHwAYW1DPh87IP0z4CXtH vGeNS/MvkiseeHUgHBt3AhUa2rzBrsxnMFknPt4v7L2tKSeWJZJLHrmDOsw3O7hTznUJ 8Oh6Pvo9K9FkeIum28kNek6s24jFyE4k0EIxvsZhsUF2CtGNg3yh1q21DY6aXkhPChLa yeZw== Received: by 10.52.36.33 with SMTP id n1mr7210537vdj.27.1346548036121; Sat, 01 Sep 2012 18:07:16 -0700 (PDT) Received: from [192.168.200.148] (c-50-131-44-225.hsd1.ca.comcast.net. [50.131.44.225]) by mx.google.com with ESMTPS id v9sm2637000ves.8.2012.09.01.18.07.14 (version=SSLv3 cipher=OTHER); Sat, 01 Sep 2012 18:07:15 -0700 (PDT) Message-ID: <5042B140.4070307@lerdorf.com> Date: Sat, 01 Sep 2012 18:07:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: Gustavo Lopes CC: Pierre Joye , Stas Malyshev , PHP Internals References: <5040DC47.8000305@ajf.me> <5040F4D9.80206@sugarcrm.com> <5042946A.80204@sugarcrm.com> <5042A7D6.7050001@lerdorf.com> In-Reply-To: X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkFZ7ki3z4ka4WKYFhcfP7wzWAA3ctV7+ncQxtM7JcPRkVAmK2pZizMbZr8iP3U6M6OBTq1 Subject: Re: [PHP-DEV] Re: Are exceptions allowed in php core? From: rasmus@lerdorf.com (Rasmus Lerdorf) On 09/01/2012 05:44 PM, Gustavo Lopes wrote: > More importantly, there is no other satisfactory solution (except a > fatal error). foreach has no return value, so it has no other way to > signal a failure. If we used a notice or a warning here what would > happen is that code that used generators with an invalid state would, > except for the notice, work as if it had been given an empty iterator. > Put another way, it would fail with only a notice, and continue. That is > a far more serious problem. In other circumstances where we emit > warnings, we usually have a return value the caller can check for error > conditions. This is the real question here. It actually isn't about Exceptions at all. It is whether trying to iterate a closed generator should be a fatal error that breaks script execution right then and there. Whether that is done as an exception or a fatal error isn't actually all that relevant since the end result will be the same for most people. If everyone is in agreement that this should be a fatal error (I don't personally get why it has to be fatal) then lets just make it a fatal error and when we come up with a decent proposal for turning recoverable fatals into exceptions language-wide we can revisit this. And this might even be in the same release, so... -Rasmus