Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83450 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29922 invoked from network); 21 Feb 2015 23:41:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2015 23:41:01 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.45 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.45 mail-qg0-f45.google.com Received: from [209.85.192.45] ([209.85.192.45:49491] helo=mail-qg0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/0C-08895-C8719E45 for ; Sat, 21 Feb 2015 18:41:01 -0500 Received: by mail-qg0-f45.google.com with SMTP id h3so19611639qgf.4 for ; Sat, 21 Feb 2015 15:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=jASQd03ayrXcgh/l8evkDa+xBq1+FMHcjDbliu5Kp7I=; b=M7Dy6lA9s64F8XAHKGVaEgsvQkRgWwcsZPz0lA7aCsLZmPoovF4emWs/vFT+eSyHiD qBAPjv7W6mdA24hqn7QglodkbPsrRw1AErWL4448xsCFk5MrhnDMcZyYc0RgUJUrOhQd /ewo6WWDIM5TODN0m1wnYKKYQ7WevrN3hHXHX+azyvChyzGsi6zVW3XevrE5j7wjcTQX HgqNTqgHRkUyg8i1X1CJLkIgREiVrDsvSUyhmPgo888Mt6Jgb2h8OfDWgkCAPataNZnu hIdfoi1jByVD1FD2S2TF4kAimWjmdxT4pa5UqC4V6A8oftUa59j8h591BMFMAoqWIlT3 4h4Q== MIME-Version: 1.0 X-Received: by 10.229.207.198 with SMTP id fz6mr5752897qcb.27.1424562058201; Sat, 21 Feb 2015 15:40:58 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sat, 21 Feb 2015 15:40:58 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sat, 21 Feb 2015 15:40:58 -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: Sat, 21 Feb 2015 15:40:58 -0800 Message-ID: To: Yasuo Ohgaki Cc: Crypto Compress , PHP internals Content-Type: multipart/alternative; boundary=089e0122eb9c7092ce050fa1b33b Subject: Re: [PHP-DEV] [VOTE] Expectations From: pierre.php@gmail.com (Pierre Joye) --089e0122eb9c7092ce050fa1b33b Content-Type: text/plain; charset=UTF-8 On Feb 21, 2015 1:54 PM, "Yasuo Ohgaki" wrote: > > 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. I pretty well know what assertions are. Thanks for the refreshing explanation anyway :) I do not see much gain today to "improve" them while I do not see why we should not. It does not hurt. My issue is more on the exception part of it and the relative unreadiness of this rfc as well as the prerequisites, see what I wrote in my past replies. > Regards, > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net --089e0122eb9c7092ce050fa1b33b--