Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75591 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7802 invoked from network); 16 Jul 2014 14:00:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Jul 2014 14:00:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:60166] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/91-31820-D8586C35 for ; Wed, 16 Jul 2014 10:00:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 546EE8C0075; Wed, 16 Jul 2014 10:00:43 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LurlbqLDIV31; Wed, 16 Jul 2014 10:00:43 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id A83CC8C007D; Wed, 16 Jul 2014 10:00:40 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <00d12255efc53466245b21a83ff7d474@mail.gmail.com> Date: Wed, 16 Jul 2014 15:00:37 +0100 Cc: Andrey Andreev , Rowan Collins , Stas Malyshev , internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <1CE2ACC0-D6CA-407B-99C7-4914311B733E@ajf.me> References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <16D48604-0C0A-4613-91A4-21392E3A2636@ajf.me> <05CE2216-C5D9-4937-9F2E-AA1407284D9F@ajf.me> <53C460DF.5040304@sugarcrm.com> <53C53A96.2040303@gmail.com> <53C55342.1010207@sugarcrm.com> <53C563B3.6060905@gmail.com> <54536191-1B92-4933-973F-0C8289D13A4C@ajf.me> <00d12255efc53466245b21a83ff7d474@mail.gmail.com> To: Zeev Suraski X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] [RFC] Scalar Type Hinting With Casts (re-opening) From: ajf@ajf.me (Andrea Faulds) On 16 Jul 2014, at 10:29, Zeev Suraski wrote: > For me the introduction of a new set of rules is a deal breaker. > I'm -1 on the RFC the way it is, and +1 if we implement these 'hints' = as > implicit casts, plus change implicit casts to emit E_CAST in case of = loss > of data or 'bogus' conversions. >=20 > Why insist E_RECOVERABLE_ERROR and introduce this effectively new set = of > rules, instead of switching to E_CAST and maintain consistency? > Maintaining consistency is a HUGE deal. Every such feature we add = that > you need to learn more rules/exceptions for make PHP harder to learn. As has been pointed out already, that would be inconsistent with = existing type hints. zend_parse_parameters emits E_WARNING and returns = FAILURE, while type hints raise E_RECOVERABLE_ERROR. To make scalar type = hints not emit E_RECOVERABLE_ERROR and instead do something weaker would = introduce *more* inconsistency, not less. Also, again, while these new rules aren=92t quite the same as zpp=92s, = they are largely the same, and these rules are able to be summed up = clearly in a single sentence, unlike the confusing and inconsistent zpp = rules. We could fix zpp later, but that would be harder as it would = break backwards-compatibility. And again, these new rules only different = from zpp in very few places (integral values, =93123abc=94 and = booleans). -- Andrea Faulds http://ajf.me/