Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75711 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49956 invoked from network); 20 Jul 2014 14:48:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jul 2014 14:48:27 -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.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:55661] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/10-48607-9B6DBC35 for ; Sun, 20 Jul 2014 10:48:27 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 604EA2400D0; Sun, 20 Jul 2014 10:48:23 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 5sCYeRi4IHNW; Sun, 20 Jul 2014 10:48:23 -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 4D9762400C6; Sun, 20 Jul 2014 10:48:20 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Sun, 20 Jul 2014 15:48:18 +0100 Cc: Zeev Suraski , Rowan Collins , "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <3345ECC0-27A1-423D-A604-81F08F8FDA1A@ajf.me> References: <08503591-EFC8-48E6-984E-FFC292C5EA5F@ajf.me> <53C3F70A.7010706@gmail.com> <3aa29e080d70c843713e19a952dfbad6@mail.gmail.com> To: Anthony Ferrara 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 14 Jul 2014, at 17:25, Anthony Ferrara wrote: > And that also hints towards a benefit of adding a numeric hint as well > (which will accept (and cast to) either an int or a float, exactly how > is_numeric_string() does internally)... Which is something that may > want to be considered for this RFC. I=92ve finally gotten round to doing this (I had to fix most of the mess = of segfaults and broken tests first). The RFC now proposes a =91numeric=92= type hint that does what you expect it to, casting to int or float. The implementation (which is done and tested for this type hint) is = straightforward, though there=92s a minor issue with casting of objects. = As IS_NUMERIC is a fake type, cast_object doesn=92t support it, so it=92ll= try IS_LONG first, unfortunately. Not much we can do about that. Actually, perhaps it would be possible to try IS_NUMERIC, and if that = fails, try IS_LONG, then try IS_DOUBLE. Should I do that? -- Andrea Faulds http://ajf.me/