Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82762 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39752 invoked from network); 15 Feb 2015 22:53:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2015 22:53:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:34685] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/04-13857-D5321E45 for ; Sun, 15 Feb 2015 17:53:18 -0500 Received: by mail-wg0-f44.google.com with SMTP id k14so16499200wgh.3 for ; Sun, 15 Feb 2015 14:53:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=jpah8LSinUHEghYgVPAp9ZNTWM0JRBVIKLYLgn9Ud2A=; b=xE+4udifxs7xHzfsIqQh+lcm4RhuQF5iBhcQWj4wtGrD5sQvA1plV1UIG2t11/xq/P zR8C6PHQ9ymm7KpahnH4Ts3cQpIEbdWxoEaN3LtwVcFQ0Y+Evwku06pau3LgmqdK1TJW 1VOwWlqJLBSJtqXxgt1uNsc1wc5LceO2qudxcYCOHFh84eqHt+A3/dblzr+pHMMp0Qh2 GxGDJGa2+MgqQcx5ZIQq/8u+Brn9JLErtS23KGUoFDXJ5ZokJxjuC7okDivUtu3vASZ2 M709uabZb/ySKYPcXHh9O2EwSnDPymExm9wtgVRXXn2U07BL16eP7wOF2XO979bosxsf SBQA== X-Received: by 10.194.240.164 with SMTP id wb4mr43436023wjc.66.1424040792385; Sun, 15 Feb 2015 14:53:12 -0800 (PST) Received: from [192.168.0.2] (cpc68956-brig15-2-0-cust215.3-3.cable.virginm.net. [82.6.24.216]) by mx.google.com with ESMTPSA id hz9sm20124415wjb.17.2015.02.15.14.53.11 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Feb 2015 14:53:11 -0800 (PST) Message-ID: <54E12349.7070806@gmail.com> Date: Sun, 15 Feb 2015 22:52:57 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: rowan.collins@gmail.com (Rowan Collins) On 14/02/2015 00:09, Yasuo Ohgaki wrote: > Hi Nikita, > > On Tue, Oct 7, 2014 at 6:53 AM, Nikita Popov wrote: > >> As such I'm re-proposing this RFC for inclusion in PHP 7: >> >> https://wiki.php.net/rfc/engine_exceptions_for_php7 >> >> The RFC text is essentially the same as previously, with the primary >> difference being that parse errors are now converted to exceptions as well. >> This was previously not possible due to limitations in the compiler design. >> > Are E_WARNING, etc future scope? > I briefly looked the patch. It seems it covers only engine errors. > I suppose it's the scope of this RFC, though. > If API is made adoptable to modules for E_WARNING, etc, it would be > great. Much though I'd love a more OO-approach to warnings, exceptions are not an appropriate mechanism for that. A rule of thumb I rather like is that you should only throw an exception in a case where your best alternative, if it is not handled, is to call die(). Clearly, E_ERROR meets this standard, and E_WARNING does not. There has been much talk previously that "exceptions are great because they include full backtraces", but there's no reason a new type of warning object couldn't also include those, while retaining the key characteristic of the default behaviour being to carry on with some fallback value (an empty loop, a null variable, etc) rather than to die('Uncaught Warning Exception!'). Regards, -- Rowan Collins [IMSoP]