Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84062 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31767 invoked from network); 28 Feb 2015 01:16:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Feb 2015 01:16:39 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.25 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.25 out1-smtp.messagingengine.com Received: from [66.111.4.25] ([66.111.4.25:60124] helo=out1-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/11-32582-7F611F45 for ; Fri, 27 Feb 2015 20:16:39 -0500 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 80267209B1 for ; Fri, 27 Feb 2015 20:16:35 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Fri, 27 Feb 2015 20:16:36 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:message-id:date:from :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; s=smtpout; bh=TPSU1BuIstRCznx7vyof5b hBnHw=; b=E7goQ6q8ox9OMLMbd1wLdpMfMQXfS8bDVqW/e9kLFl1zFIhdWedBDS EorcnnmN+Qnl+MGnv0W0xzUcXnzfp96bXd10DnmSe9bDvxPyhypa05DbIzVMWvW+ YUrbTejExGh/kCWdfLCHfYiY2TxnLKINYMR1ZXPG9cs+Fdb9/WPU8= X-Sasl-enc: L8woj6s5/e68NCMSfmkkLwcIOHbpvQnd4RCmcQdnTKzg 1425086196 Received: from Palantirs-MacBook-Pro-7.local (unknown [63.250.249.138]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D075C00297 for ; Fri, 27 Feb 2015 20:16:36 -0500 (EST) Message-ID: <54F116F3.1060101@garfieldtech.com> Date: Fri, 27 Feb 2015 19:16:35 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][VOTE] Scalar Type Declarations v0.5 From: larry@garfieldtech.com (Larry Garfield) On 2/26/15 8:58 AM, Anthony Ferrara wrote: > All, > > I have opened voting on Scalar Type Declarations v0.5. Please cast your vote. > > https://wiki.php.net/rfc/scalar_type_hints_v5#vote > > The vote will remain open until March 13th, 2015 or until the date a > competing RFC closes voting, whichever is later. > > Thanks > > Anthony As both you and Matthew noted in an earlier thread, technically these RFCs are not competing. They're not Apples and Oranges, but more like Gala Apples and Honeycrisp apples. (Now I'm hungry...) We seem to all be agreed about adding scalar type hints, starting from the current "weak" baseline. Yay, agreement! Can haz? Please? After all these years? One proposal is to then go a step further and add a pedantic (strict) mode that is opt-in by the caller. Pros and Cons. Another proposal is to tighten up the casting rules of PHP itself, with the exact tightening to do still being up for debate. Pros and Cons. Those are not mutually exclusive. They're not quite orthogonal, but they're distinct asks. Personally I rather like both. I think the doom-and-gloom charges against both are greatly over-wrought. And remember that in both cases, *all scalar typing is still opt-in* for user-space code. I would argue absolutely against another ini setting that changes the language behavior. (As in, Holy mother of Vint Cerf that !) But the more recent samples from Zeev seem promising that the changes are minor enough that we won't need that. The main questions seem to me: 1) For strict mode, is it going to lead to sufficient confusion that people abuse it and do stupid things, and is that risk larger than the potential benefit of easier static analysis (either offline or at compile time) in the future? I am fairly well convinced that if used judiciously a reasonable codebase can leverage strict mode quite heavily without having to throw lots of casts around. What percentage of the PHP using population can be "judicious" is a debatable point. 2) For pickier coercion, is the tightening of types on core functions (remember, opt-in for user-space code) going to cause sufficient breakage that people are dissuaded from upgrading? This depends heavily on what gets tightened, so we can debate that at length, but I believe it is possible to tighten them enough to be useful without being so tight that it breaks the whole world. Also, keep in mind there's 2 classes of software to think about. The Drupal, Wordpress, Magento, Symfony, etc. developers will update their code to be compatible no matter what. Those core systems will get enough pushback that they'll update one way or another; the developers may throw rotten apples at us (either gala or honeycrisp), but we survived call time pass by reference and the tighter array/string conversion handling in 5.4. Speaking as a Drupal developer: We'll manage. (And those big systems account for, all together, a majority of the lines of PHP actually running in the wild today; to be fair that's mostly Wordpress's doing but still.) Then there's the random script kiddy code, or the code that was perfectly sensible in 2002 that is still running unchanged despite everyone's best judgement. This is the code that scares shared hosts. That code probably won't be moved to a PHP 7 server until 7.4 is out *anyway*, no matter what we do. How badly tighter coercion rules impacts this code is a debatable point, and heavily dependent on what tightening happens. In any case, my point is that we don't need to make it an either/or question. These are both viable, logical extensions to adding basic scalar typing, but not mutually exclusive and no need to turn into "camps". If both pass, that's OK. Really, it's OK. Go home and have an apple. :-) --Larry Garfield