Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84967 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42703 invoked from network); 16 Mar 2015 02:17:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2015 02:17:14 -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.214.169 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.169 mail-ob0-f169.google.com Received: from [209.85.214.169] ([209.85.214.169:36816] helo=mail-ob0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E5/CC-06614-92D36055 for ; Sun, 15 Mar 2015 21:17:14 -0500 Received: by obdfc2 with SMTP id fc2so25829076obd.3 for ; Sun, 15 Mar 2015 19:17:11 -0700 (PDT) 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=PmFtQUgvwb0zz13b4oo7j9B/NSMSdnhNu+IWzTSd28o=; b=RDQ9ubzu3nY35lMEZLLz98cCstAxkNNkPIrogdN40yMiwTrDk82AZ1xidlxCkBQz44 IEA5lCmB4eLnqNwGFhYKnxVmsn8xntU0zBcZH3kQxfhcHpkfzQqLppyclySFgdQBo+MQ I6gcTWKscWC6pFlk4JVvNsj0RwSeSEtDQO6UO/FjT48gUSMnsdjuf6u9S1zNJtjiL1Fk RQEWoVHwbhKZ0BB9lIKWvcU4c+DilKxxCAcs2Iif1M+Rbzy+fEnOMHr429dDm9pTHYgR Z2IktwVfOfiLkBvCeHQw7AQt9XPKP7p+sI4ggTJKriHt1kDwwLGrmyYPXxgHlVkgVLUO 7UUg== X-Received: by 10.60.97.35 with SMTP id dx3mr45651405oeb.6.1426472231226; Sun, 15 Mar 2015 19:17:11 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.58.2 with HTTP; Sun, 15 Mar 2015 19:16:31 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Mar 2015 11:16:31 +0900 X-Google-Sender-Auth: C_r5RORuG-KWZCnXw234qXkT6Us Message-ID: To: Pierre Joye Cc: Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=089e01227a189fd2a605115e7237 Subject: Re: [PHP-DEV] [RFC][Status] Scalar Type Declarations Voting Date Change From: yohgaki@ohgaki.net (Yasuo Ohgaki) --089e01227a189fd2a605115e7237 Content-Type: text/plain; charset=UTF-8 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. > > > 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. 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. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --089e01227a189fd2a605115e7237--