Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75722 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67818 invoked from network); 20 Jul 2014 16:26:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2014 16:26:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=theodorejb@outlook.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=theodorejb@outlook.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain outlook.com designates 65.55.111.169 as permitted sender) X-PHP-List-Original-Sender: theodorejb@outlook.com X-Host-Fingerprint: 65.55.111.169 blu004-omc4s30.hotmail.com Received: from [65.55.111.169] ([65.55.111.169:52665] helo=BLU004-OMC4S30.hotmail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 78/C3-48607-9CDEBC35 for ; Sun, 20 Jul 2014 12:26:50 -0400 Received: from BLU179-W59 ([65.55.111.135]) by BLU004-OMC4S30.hotmail.com with Microsoft SMTPSVC(7.5.7601.22712); Sun, 20 Jul 2014 09:26:47 -0700 X-TMN: [BqRn5JXG04IQlguBQYSeLRti5SWPj62W] X-Originating-Email: [theodorejb@outlook.com] Message-ID: To: Andrea Faulds CC: "internals@lists.php.net" Date: Sun, 20 Jul 2014 11:26:46 -0500 Importance: Normal In-Reply-To: <5B708D89-B208-4644-BC89-1B7AE98A99BA@ajf.me> References: <20A80B2E-42BB-486F-8F83-A6FDBEBA4056@ajf.me>,<5B708D89-B208-4644-BC89-1B7AE98A99BA@ajf.me> Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 20 Jul 2014 16:26:47.0134 (UTC) FILETIME=[66C46FE0:01CFA437] Subject: RE: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: theodorejb@outlook.com (Theodore Brown) On 18 Jul 2014=2C at 14:09=2C Andrea Faulds wrote:=0A= =0A= > I=92ve updated the RFC and patch to make int=2C string and double nullabi= lity work like the other types (bool already did). If the default value isn= =92t NULL=2C NULL isn=92t accepted and you=92ll get E_RECOVERABLE_ERROR. If= the default value is NULL=2C NULL is accepted and will not be casted.=0A= >=0A= > This will likely lead to less bugs as NULL is a common error value=2C and= it also makes the scalar type hints more consistent with the others.=0A= =0A= Thank you very much for making this change. It goes a long way towards maki= ng scalar type annotations more useful to me as a userland developer. Also= =2C I really like the new "numeric" type hint.=0A= =0A= The one remaining issue I have with this proposal is that boolean values ar= e currently accepted for every other scalar type except array. As with NULL= =2C FALSE is a common error value=2C and allowing booleans to be passed to = a function expecting a string or numeric value could easily mask errors and= lead to hard-to-debug issues in a program. Just as a string cannot be pass= ed to a function expecting a boolean=2C a boolean should not be passed to a= function expecting a string=2C etc.=0A= =0A= Thanks for all you do for the community.=0A= =0A= --=0A= =0A= Theodore Brown=0A= =0A= A PHP developer interested in the future of the language =