Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84980 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64740 invoked from network); 16 Mar 2015 03:31:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 03:31:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.49 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.49 mail-qg0-f49.google.com Received: from [209.85.192.49] ([209.85.192.49:33930] helo=mail-qg0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E1/61-06614-3AE46055 for ; Sun, 15 Mar 2015 22:31:49 -0500 Received: by qgh62 with SMTP id 62so30474464qgh.1 for ; Sun, 15 Mar 2015 20:31:45 -0700 (PDT) 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=/HGI8itrbfDJZSieNAXxUnN4IAjbYPCTsWuejCliqCg=; b=Rgfb0uyGadSrwRoSRT8TK2TbrxRPhoVwZBO4e8O7+yk2SDPdcocdIb0+WngZyYAsQ/ mkZ/EqS43G9vkyBI5HOpcCqmYqcckMlzzFpFpGkq9r3frlLZsctYWOfM6JIn86aZR6pD vjeaef7tQfFBTOP3QHq+yvuaJr1x4STHYw/m6h0pu8JGbOBycBIZBSdQc5Pk4uulmneg qciecE1QjxKb1VT7h5BEZjyXtaEAY7xkSCBC1GdeqyTWzn++1GXj2kXOfC93EcYs50zh dDJmL5RG4j12Tla3AAl21b1fes77LrV9zhj2PlMygGigQTdB5HL2mJ9wPvVOOtZcDZ4w +Brw== MIME-Version: 1.0 X-Received: by 10.55.33.41 with SMTP id h41mr108284025qkh.69.1426476705259; Sun, 15 Mar 2015 20:31:45 -0700 (PDT) Received: by 10.96.39.195 with HTTP; Sun, 15 Mar 2015 20:31:44 -0700 (PDT) Received: by 10.96.39.195 with HTTP; Sun, 15 Mar 2015 20:31:44 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 14:31:44 +1100 Message-ID: To: Yasuo Ohgaki Cc: PHP internals , Anthony Ferrara Content-Type: multipart/alternative; boundary=001a114005424c299e05115f7d96 Subject: Re: [PHP-DEV] [RFC][Status] Scalar Type Declarations Voting Date Change From: pierre.php@gmail.com (Pierre Joye) --001a114005424c299e05115f7d96 Content-Type: text/plain; charset=UTF-8 On Mar 16, 2015 1:17 PM, "Yasuo Ohgaki" wrote: > > Hi Pierre, > > On Mon, Mar 16, 2015 at 10:48 AM, Pierre Joye wrote: >> >> > Coercive type for general developers and strict type for library developers >> > will >> > eliminate more type related bugs, more natural to average PHP users. IMHO. >> >> And change casting rules, open a pandora box. And even worst, it is a >> zero compromise RFC. Same as before, no need to discuss that any >> longer. > > > "The same way before" is going to cause problems, or hide problems at least. > As Zeev's patch revealed, people do mistakes and the patch helps to find them. > > "The same as before" will just hide these hard to find bugs. I am against changing how PHP behaves with casting and co, as it does for years. This is extremely dangerous. >> >> >> > It's natural that we have different point of views, but we can easily >> > understand/guess >> > the consequence of the RFC. Weak mode is simply too weak to be useful. >> > Strict mode will hide type bugs by errorless casts. >> >> Show me examples when something not in strict mode behave differently >> and it will be fixed. But saying that is per se wrong and double >> standard in regard of voting. Or why did you vote in favor of other >> RFCs which obviously had or still have bugs? > > > This code is an example that I posted in other thread. > > e.g. > function check_num_range(int $num) { if ($num < 0 || $num > 100) trigger_error('Invalid range'); } > // Somewhere far from function definition. > $num = $GET['num']; > // Somewhere far from $num definition. > check_num_range($num); // Trying to check validity, int and range. > echo 'You have '.$num. ' now
'; // But $num could have any string. > // "check_num_range((int)$num)" wouldn't help also. > ?> > > Simple cast hides bugs, not eliminates type bugs. > This is just an example and there are many cases that cast hides bugs in real world codes. > >> >> > I hope both you and Zeev work together to satisfy most needs because >> > hiding bugs are not good thing to do. >> >> It does but I do not claim that there are no bug, every code has bugs >> and they should be fixed. > > > I'm not saying the proposed patch has bugs, but I'm saying it hides "users' code bugs". > > Hiding hard to find bugs does not make much sense while there is the proposal that finds it. > What I'm trying to say is "Why don't we collaborate?". Let users fix bugs at first, then > introduce more strict type checks if it's needed. Coercive type and strict type can co-exist > together well, but weak type and strict type cannot. This example is out of the scope of this rfc. As I said many times, you want to make php more friendly and let users write better code, that's a good thing. However changing by default how php behaves for decades is a no go for me. It will create more issues than it solves. --001a114005424c299e05115f7d96--