Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84080 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27277 invoked from network); 28 Feb 2015 18:32:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2015 18:32:35 -0000 Authentication-Results: pb1.pair.com header.from=cryptocompress@googlemail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cryptocompress@googlemail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.48 as permitted sender) X-PHP-List-Original-Sender: cryptocompress@googlemail.com X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:35759] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/11-20255-1C902F45 for ; Sat, 28 Feb 2015 13:32:34 -0500 Received: by wggz12 with SMTP id z12so26189623wgg.2 for ; Sat, 28 Feb 2015 10:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=mJOjrbbvNNFSLiyC6LuhVrJHkLx6OoPexwO6nmUyO6g=; b=ciUtJxciGIEhv8Xg5ncs41jXim1QBLhC1jKkiLzxXYjmJSvWwKM5Jjr5RdbQr+Br+T xR0Nxh06fA0g5sr6nHQjIOoaiEMhOS5UeIKV0z+7wKuMDDBABEYehE3P/c8Zb3Qq9d4b Y5i8kTsrAT1BPdEhUF1yuk/51PZGbFaHlj0i+ZCyMFB2oGq7nRehm+FOEbvT3u1Pkn72 5vqOPWawJQ8q6x9lNuj1BW7d6QoBUH/ecAnUEPKXacsBWgDkQFum+gKfjaFoMLJSNaYn dTJmZ5Rg0ucaW0EQaL2kzkQ1/XJ+eWMrnyZ4O/ZDNx1vxKpUgDDM4T5ViwVvFNYzwIje OGZw== X-Received: by 10.194.201.103 with SMTP id jz7mr42131009wjc.14.1425148349198; Sat, 28 Feb 2015 10:32:29 -0800 (PST) Received: from [192.168.1.115] (mnch-5d85f138.pool.mediaWays.net. [93.133.241.56]) by mx.google.com with ESMTPSA id hj10sm11151533wjc.48.2015.02.28.10.32.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 Feb 2015 10:32:28 -0800 (PST) Message-ID: <54F209B9.5020200@googlemail.com> Date: Sat, 28 Feb 2015 19:32:25 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Yasuo Ohgaki CC: PHP Developers Mailing List References: <54E5F77D.9090406@fischer.name> <54E6F48A.9040906@fischer.name> <54E72FE7.9030803@googlemail.com> <54E7312D.9090404@googlemail.com> <54E73E70.5020403@googlemail.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------050804010908090804000505" Subject: Re: [PHP-DEV] [VOTE] Expectations From: cryptocompress@googlemail.com (Crypto Compress) --------------050804010908090804000505 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Am 21.02.2015 um 04:10 schrieb Yasuo Ohgaki: > Hi Crypto, > > On Fri, Feb 20, 2015 at 11:02 PM, Crypto Compress > > > wrote: > > AssertionExceptions are not intended to be caught, they are > intended to be seen, in a specific environment. > > > Joe, your argumentation is around how (not) to use exceptions. I > can see your point and it's valid. > My point is about not to implement exceptions at all. > > If exceptions are not intended to be caught, they don't need to be > thrown (even if the context is different). > If exceptions are not thrown and not caught, we can use "error" in > dev and some easing severity (warning, zero cost nothing) in prod. > > Freely adapted from Murphy: If assertion exception can be catched, > it will be even in production. > > > Assertion is only for development and testing. > We need errors or exceptions during development and testing, but > not in production. Therefore, errors/exception should not be catched > by code in general. Isn't assertion nature? > > I don't insist not to enable assertion in production environment. > There might be software that needs extreme reliability and stability. > For these softwares, it makes sense to enable assertions and catch > errors/exceptions to do some cleanups. > > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net Hi Yasuo, sorry for the late answer. My point is about throwing exceptions (assert.exceptions=1). I think it is wrong to allow to change code-flow by ini-setting and in current context it is wrong to throw exceptions altogether. Let's assume this code example in dev-mode with exceptions: class BankAccount { function Add($amount) { assert($amount > 0); // ... code block ... } } Now the programmer implementing "code block" to gracefully handle $amount > 0 has a problem. There is no way to (Unit)test failing path on development machine. Code after assertion is never called for failing contitions. What to do? Delete assertion is out of question. Disable zend.assertions on development machine seems to be the wrong way too. The only way to handle this is to disable exceptions (assert.exceptions=0) so expected code flow is restored. This, if allowed to be changed, should be at least the default. IMO ability to run and test code broadly outweighs "provides stacktrace by default" argument and for some reason i fear assert.exceptions=1 will be the only case soon. cryptocompress --------------050804010908090804000505--