Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67059 invoked from network); 11 Mar 2015 17:11:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2015 17:11:30 -0000 Authentication-Results: pb1.pair.com header.from=theodorejb@outlook.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=theodorejb@outlook.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain outlook.com designates 65.54.190.91 as permitted sender) X-PHP-List-Original-Sender: theodorejb@outlook.com X-Host-Fingerprint: 65.54.190.91 bay004-omc2s16.hotmail.com Received: from [65.54.190.91] ([65.54.190.91:63196] helo=BAY004-OMC2S16.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/9A-07702-F3770055 for ; Wed, 11 Mar 2015 12:11:29 -0500 Received: from BAY178-W5 ([65.54.190.125]) by BAY004-OMC2S16.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22751); Wed, 11 Mar 2015 10:11:20 -0700 X-TMN: [ek1pSvXkfl8KbQIeysZcHcESI17nfbzs] X-Originating-Email: [theodorejb@outlook.com] Message-ID: To: "zeev@zend.com" CC: "internals@lists.php.net" Date: Wed, 11 Mar 2015 12:11:20 -0500 Importance: Normal Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 11 Mar 2015 17:11:20.0612 (UTC) FILETIME=[64F24E40:01D05C1E] Subject: Re: [VOTE][RFC] Coercive Scalar Type Hints From: theodorejb@outlook.com (Theodore Brown) Zeev=2C=0A= =0A= > The vote on the Coercive Scalar Type Hints is now open for voting.=0A= > =0A= > The latest version of the RFC includes changes discussed on internals@ la= st=0A= > week:=0A= > =0A= > 1.=A0 Accept string->bool and int->bool conversions (false->bool is not= =0A= > supported)=0A= > 2.=A0 Accept leading/trailing spaces in string->number conversions.=0A= > =0A= > wiki.php.net/rfc/coercive_sth=0A= > wiki.php.net/rfc/coercive_sth#vote=0A= > =0A= > Thanks!=0A= > =0A= > Zeev=0A= =0A= The proposed coercion rules aren't clear. The first table in the RFC implie= s=0A= that string is accepted for bool hints=2C and the second table says this is= =0A= unchanged. But the examples section states that "foo" -> bool will raise an= =0A= E_DEPRECATED error. I'm guessing this is a mistake=2C since you mentioned= =0A= above that string->bool is accepted.=0A= =0A= You also stated above that false->bool is not supported (I'm guessing you= =0A= meant float->bool). So users would be able to pass "4.3" to a bool typehint= =2C=0A= but not 4.3? This behavior seems very arbitrary and confusing.=0A= =0A= Not only would this RFC introduce backwards compatibility breaks in a futur= e=0A= PHP release=2C but it still doesn't bring the same opportunities for static= =0A= analysis which the optional strict mode in Anthony's proposal enables.=0A= =0A= The coercive RFC misleadingly contradicts itself by stating that "we don't= =0A= believe that is the case" "that Strict STH can help static analysis in=0A= certain cases" "although it's possible that Strict Typing may be able to=0A= help static analysis in certain edge cases." Do you believe it will help in= =0A= certain cases or not?=0A= =0A= Strict types can absolutely help - not only for static analysis=2C but also= =0A= for potential future AOT/JIT development. Why? Because only types need to= =0A= be checked=2C rather than values. This is why an optional strict type syste= m=0A= in JavaScript makes it possible for Google to make "early and aggressive=0A= optimisations" in V8 (see https://developers.google.com/v8/experiments).=0A= It also makes it possible to catch errors earlier in development (see the= =0A= example in my "A different user perspective on scalar type declarations"=0A= email). As a developer of large enterprise applications=2C these benefits= =0A= are very important to me.=0A= =0A= > Static Analyzers need to be designed for Languages=2C rather than Languag= es=0A= > being designed for Static Analyzers.=0A= =0A= You really have this backwards. Why do you think Facebook created Hack?=0A= Why did Microsoft create TypeScript? Why are there serious discussions=0A= to add optional strict typing to ECMAScript proper?=0A= =0A= Theodore Brown=0A= =