Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76137 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34859 invoked from network); 25 Jul 2014 19:29:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2014 19:29:16 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:37618] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/5A-08559-B00B2D35 for ; Fri, 25 Jul 2014 15:29:16 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id F19A18800E2; Fri, 25 Jul 2014 15:29:18 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UTIqVXCdrE-c; Fri, 25 Jul 2014 15:29:18 -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 1FB788800FA; Fri, 25 Jul 2014 15:29:14 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: <53D2AE01.8020806@sugarcrm.com> Date: Fri, 25 Jul 2014 20:29:11 +0100 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <253874AE-F389-4357-8FBD-7135C02BD797@ajf.me> References: <20A80B2E-42BB-486F-8F83-A6FDBEBA4056@ajf.me>,<5B708D89-B208-4644-BC89-1B7AE98A99BA@ajf.me> <6A40E21F-D265-4ADC-AD79-4EDB7AB45A01@ajf.me> <53D2AE01.8020806@sugarcrm.com> To: Stas Malyshev 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 25 Jul 2014, at 20:20, Stas Malyshev wrote: > This makes very little sense, 0 means the same as false is in many > contexts in PHP and also in many languages. It also means very different things in some places, particularly return = values. strpos returning 0 is most definitely not the same thing as = strpos returning FALSE. That=92s a big reason why FALSE and TRUE aren=92t = accepted for int type hints: bools are common error values. > Having random arcane rules > would only make the users curse us every time they get tripped by = them. The rules are not random nor arcane. > I call everybody to vote against this RFC - it's better not to have = such > thing at all then to promise our users improvement only for them to > discover this improvement is fraught with inconsistent arbitrary rules How are they inconsistent and arbitrary? These rules haven=92t been = picked at random from a hat, they=92ve come from a process of careful = thought. Casting an integer to a string and vice-versa makes sense and = is a common operation ($_GET[=91id=92]), while casting a NULL or FALSE = to a string doesn=92t really make sense (when do you need to do this?), = and is unlikely to happen unless something=92s gone wrong. > that do not match what the rest of the language is doing That is true, but it would be possible to change zpp later. > - even within > the same context of the function call. I can see no uniting principle > behind this table, which is randomly strict and randomly non-strict > without connection to the rest of PHP. I do not think it is the right > thing to have such thing in the language, even if it would help > somebody's particular use-case. The point of this RFC is to strike a compromise that is generally useful = rather than helping one specific use case (strict hints) or another = (casts). -- Andrea Faulds http://ajf.me/