Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83784 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44996 invoked from network); 25 Feb 2015 13:19:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 13:19:42 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.178 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.178 mail-we0-f178.google.com Received: from [74.125.82.178] ([74.125.82.178:39719] helo=mail-we0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/01-62407-DEBCDE45 for ; Wed, 25 Feb 2015 08:19:42 -0500 Received: by wesx3 with SMTP id x3so3548857wes.6 for ; Wed, 25 Feb 2015 05:19:39 -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=jErxJINLeeDOhzHkhkvmA1sFPinvwQroKz01nDbu35M=; b=FGlmho0qgHLHVTACWGxWS902YCphyfxCWU01iw3CW7d7AXhrbANh1gc7a65DBVTuAd 3JXxJvmZH2vDgYVINRZoQBWko2G42VSaBulSL0LbsN8RsI3hc0gmghpOgMpTnu5Ye9aO 9fT8hyeZbXSKFJnawBGp2crlRuWxGrgFLawnIK9kMRlPRIpuTejwCEm02EHuMTBJ+dYW zGKwatzopAzuYcCBG9uS1RB71QrnmET6tdL1DWickiJWu3KNfooKw+954Yz34Hhw8LiH zxfWjYpNxJ9SxDYUFNZDexcx/O0qYgsrkVpq07wyNZNLmTGkJCLg7NqyWqV9BsGIXqRS 1Puw== X-Received: by 10.180.75.200 with SMTP id e8mr38711533wiw.95.1424870379167; Wed, 25 Feb 2015 05:19:39 -0800 (PST) Received: from [192.168.0.136] ([62.189.198.114]) by mx.google.com with ESMTPSA id hd5sm25129202wib.21.2015.02.25.05.19.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2015 05:19:38 -0800 (PST) Message-ID: <54EDCBD6.70302@gmail.com> Date: Wed, 25 Feb 2015 13:19:18 +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: <54E12349.7070806@gmail.com> <16.9B.05176.AE1C1E45@pb1.pair.com> <54E1C993.1070609@gmail.com> <37.20.01961.31113E45@pb1.pair.com> <54E32CAA.5030600@gmail.com> <54E4FAC2.7060200@gmail.com> <47.89.25547.DD007E45@pb1.pair.com> In-Reply-To: Content-Type: text/plain; charset=koi8-r; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Exceptions in the engine From: rowan.collins@gmail.com (Rowan Collins) Tony Marston wrote on 21/02/2015 10:08: > ""Nikita Nefedov"" wrote in message news:op.xuco5eutc9evq2@nikita-pc... >> >> On Fri, 20 Feb 2015 12:39:33 +0300, Tony Marston >> wrote: >>> >>> I disagree. Exceptions were originally invented to solve the >>> semipredicate problem which only exists with procedural functions, >>> not object methods. Many OO purists would like exceptions to be >>> thrown everywhere, but this would present a huge BC break. If it >>> were possible get these functions to throw an exception ONLY when >>> they are included in a try ... catch block then this would not break >>> BC at all. >>> >> >> Tony, first of all - this still breaks BC, because exception is being >> thrown in a place where it used not to be... > > I disagree. The following function calls would not throw exceptions > fopen(...); > fwrite(...); > fclose(...); > > while the following code would: > try { > fopen(...); > fwrite(...); > fclose(...); > } catch (....) { > .... > } But what about this code, which could well already exist: try { $fh = fopen(...); $this->processLotsOfDataAndMaybeThrowAnException($fh); fclose($fh); } catch (....) { .... } If fopen() starts throwing exceptions here, that's as much a BC break as it throwing them everywhere. If it doesn't, the rules for when it should throw become even more complicated, and useful in even fewer cases. Regards, -- Rowan Collins [IMSoP]