Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83800 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75579 invoked from network); 25 Feb 2015 15:31:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Feb 2015 15:31:30 -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.51 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.192.51 mail-qg0-f51.google.com Received: from [209.85.192.51] ([209.85.192.51:36161] helo=mail-qg0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 36/E6-62407-0DAEDE45 for ; Wed, 25 Feb 2015 10:31:29 -0500 Received: by mail-qg0-f51.google.com with SMTP id z60so3481766qgd.10 for ; Wed, 25 Feb 2015 07:31:26 -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:content-transfer-encoding; bh=CNiAgYx1ILE/lmy3RBiAq5qOhjYVHiElHuewsjNby4U=; b=jCRuzuMPwMeGfyCJcJpbGwJvyWx5r1VLCLE7vYqlGZ+QDa12E06Y/isirXQTXJ7dGp yWpuWxesPjsodeAh8TpUUZfZfvnaIykfekmSJbp67bp0k9sCgME2BFelZ/0whFIW4LFK UGl7sF1kMkerICkElsqeIVhXDDHy5eavtK/1WNtnrGW225FpiaQEmz9TmQdNNW216Bn9 EIZLLrrGfRk/l0O6EpC7oQIhP5TxtaY48Ia2VtHZEohGFwWFS2v3dllE0wwWMVdD6T4y BUpGBprWUsxQmHUqEZEl56f2XC3R7MCsBAurm2+V11YHT/jL+dw4sC7XAPB/Bm27iU8s Eajg== MIME-Version: 1.0 X-Received: by 10.140.238.13 with SMTP id j13mr7989002qhc.75.1424878286275; Wed, 25 Feb 2015 07:31:26 -0800 (PST) Received: by 10.96.39.195 with HTTP; Wed, 25 Feb 2015 07:31:25 -0800 (PST) In-Reply-To: References: <7ef509ef10bb345c792f9d259c7a3fbb@mail.gmail.com> <8250289916f5128b5bc1a114428d374e@mail.gmail.com> Date: Wed, 25 Feb 2015 07:31:25 -0800 Message-ID: To: Zeev Suraski Cc: Anthony Ferrara , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Coercive Scalar Type Hints RFC From: pierre.php@gmail.com (Pierre Joye) On Sat, Feb 21, 2015 at 2:47 PM, Zeev Suraski wrote: >> "with two potential 'camps' of developers forming up" >> >> Have you looked at the community lately? That's been happening for a >> decade. One camp likes to engineering everything out using classes and >> libraries. The other keeps using PHP procedurally and ignoring changing >> "best >> practices" (and I do mean the quotes). Does that make one better than th= e >> other? NO. > > I don't think these two camps map to the strict and dynamic camps, > definitely not for the userbase at large. Actually yes, it is slightly like that. > Which means that whatever camps we have today, we'd have more - one extra > point of division. We do, while one RFC allows a smooth, BC breaks free (100% safe) migration path to 7 for existing apps or code. >> And that's PHP's strength. It gives both sides the power to keep doing >> what >> they want to be doing without having to give up or be burdened by the >> other >> side. > > I explained both in the RFC and here why I don't think providing two mode= s > for doing something quite similar are good. We can agree to disagree :) And I explain here many times why changing the casting rules is a bad risky idea to begin with. >> Sure, some people will do that. Just like people still use single quotes >> because >> they are faster. > > Not quite IMHO - that example actually requires some relatively advanced > knowledge. Strict, with the amount of noise that Scalar Type Hints are > bound to get (and are already getting) - is bound to have a lot more > exposure than single quotes being faster ever had. And it's therefore ve= ry > likely it'll be used by people who shouldn't really be using it. > > Let's leave the Static Analysis part aside, and agree to disagree as we > already did numerous times but failed to implement. Pure suppositions and again extrapolating from nothing. It is as always a documentation matter and as usual many users won't even know it exists and simply update PHP. It should work smoothly, without BC and that's what will happen by default if we don't change the default way to deal with casts. >> > Two more things regarding the competing RFC =E2=80=93 it=E2=80=99s sti= ll alive, and >> > being promoted for PHP 7.0; And while it doesn=E2=80=99t create a hug= e BC >> > break, it allows developers to selectively create localized BC breaks, >> > on a per file basis. >> >> No, it does not. A BC break is something where existing code works, and >> you >> do nothing more than upgrade and have the new code not work anymore. >> >> With the other dual-mode RFC, if a user opts-in (enables strict mode), i= f >> code >> doesn't work that's not a BC break. That's a case of "you told us explic= it >> you >> don't want this code to work if it's invalid, and guess what, it's >> invalid". > > That's splitting hairs IMHO. The bottom line is that many people will > undergo the same process Rasmus did as he experimented, flipping the swit= ch > on because it's a best practice, and start having to fix their code to wo= rk. > But we can also agree on what we always agree here too :) It is not splitting hair, it is the key point of the dual mode. A given user can simply ignore the type hinting and keep using what its apps do, and it will work. He can as well focus one area, or addon to its app, to use strict mode (and will only apply to the files used by this specific addon and nowhere else!! ). With the other RFC, which changes the casting modes, I wish everyone good luck. I may be wrong, can happen ;), but we simply do not know and will not know before 7.0.0 is out. Good luck to change them again to "adapt and tweak", and good luck to the apps developers to adapt their apps with plenty of patch versions checks. This is the reason #2 why I am against your RFC, the #1 being the total lack of actual non magic casting (read: strict), optionally enabled. Cheers, --=20 Pierre @pierrejoye | http://www.libgd.org