Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83435 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4220 invoked from network); 21 Feb 2015 21:54:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 21:54:35 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.41 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.192.41 mail-qg0-f41.google.com Received: from [209.85.192.41] ([209.85.192.41:35972] helo=mail-qg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/E6-08895-99EF8E45 for ; Sat, 21 Feb 2015 16:54:33 -0500 Received: by mail-qg0-f41.google.com with SMTP id i50so19386454qgf.0 for ; Sat, 21 Feb 2015 13:54:30 -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:from:date:message-id :subject:to:cc:content-type; bh=jPkFSO+0KWr5QP8gWcGkqJT7mLJe5553THIaxMXAVFs=; b=wN3c3/qr/CrAUFqGKYFg/p2OWbo6jm3Z91chTY8hVBFJXB0Y9upLm1xh26YKo7EIGC v0Uicy1f4AJt75z6UbkZbtBSm1LXbxL/8tizDZgHr6BYVf4RsULVscfhEfomnJxN+Zne nM0VILYnWTgG5O7p8bGbxAgq5vXSMwcsPqxRNoM16DiKyoVnE6ACyD7ClB8FhtkE7sWO xsUi/1rH/ol0KaflYKcqTeXeoaVjkyrQWkVS5nwCIjjtD51DSznQRyN6CCszIs3t6Pjt iDIrgrhvvwcesYA0kCZm7nIMoQyh2VLD83AWU3LVIWI5LWWwB4A2KiFxEkxKe8M0P1s7 8Deg== X-Received: by 10.140.146.6 with SMTP id 6mr9666765qhs.44.1424555670542; Sat, 21 Feb 2015 13:54:30 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.229.198.8 with HTTP; Sat, 21 Feb 2015 13:53:50 -0800 (PST) In-Reply-To: References: <54E5F77D.9090406@fischer.name> <54E6F48A.9040906@fischer.name> <54E72FE7.9030803@googlemail.com> <54E7312D.9090404@googlemail.com> <54E73E70.5020403@googlemail.com> Date: Sun, 22 Feb 2015 06:53:50 +0900 X-Google-Sender-Auth: Hsmw7c50-alWHzMgTkAcVmFj2BA Message-ID: To: Pierre Joye Cc: Crypto Compress , PHP Developers Mailing List Content-Type: multipart/alternative; boundary=001a11352672b4a339050fa03620 Subject: Re: [PHP-DEV] [VOTE] Expectations From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11352672b4a339050fa03620 Content-Type: text/plain; charset=UTF-8 Hi Pierre, On Sun, Feb 22, 2015 at 2:53 AM, Pierre Joye wrote: > > 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. > > This last paragraph makes me wonder why in the world assert in PHP is > still anything valid. If anything it should be removed, to be honest. > > Which softwares do not require to be reliable and stable? Most if not > all PHP written software interact with external inputs, be from APIs > point of view or from actual users. Per se, they have to be validated > and errors handling is part of this validation. > > I do see some values for asserts in unit tests, but that's pretty much > all I can think about it. > > All in all, I stay with my initial comment, this RFC needs more > discussion and some other critical questions must be answered before > this RFC. We don't put test code checks in production code, do we? Testing and assertion is to prevent simple bugs, to help finding bugs. Once development/testing is done, these code will not be needed. You may think assertion as contracts of code. Once developers ensured all contracts were kept, contract validations are not needed anymore. By this proposal, developers can check contracts anywhere in code, any number of times during development without sacrificing production code efficiency. This helps to write solid code. Assertion would be great tool for library/framework developers to prevent users to abuse/misuse it also. Even if we test software with comprehensive manner, software has bugs. Assertion may help to detected/prevent "unexpected" software behavior. It's users choice if they enable assertions. Assertions are supposed _not_ to do any useful checks in production, but it may help. I agree that users may abuse/misuse assertion, but most tools can be abused/misused like require()/include(). I agree that users _must_ validate all input/output (and PHP should help it). These validations must be done as usual code, not assertion. I hope I could explain well enough. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11352672b4a339050fa03620--