Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58806 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46556 invoked from network); 9 Mar 2012 06:52:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Mar 2012 06:52:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=lists@rotorised.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lists@rotorised.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain rotorised.com from 203.88.115.241 cause and error) X-PHP-List-Original-Sender: lists@rotorised.com X-Host-Fingerprint: 203.88.115.241 ironport1-mx.cbr1.mail-filtering.com.au Received: from [203.88.115.241] ([203.88.115.241:62887] helo=ironport1-mx.cbr1.mail-filtering.com.au) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 28/95-10820-C88A95F4 for ; Fri, 09 Mar 2012 01:51:57 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGALinWU+va78L/2dsb2JhbABDgwmzKIIKAQEFJxFAEQsYCRYPCQMCAQIBRRMIAQEXh266F400gyIEmy6DXYZXgnU X-IronPort-AV: E=Sophos;i="4.73,555,1325422800"; d="scan'208";a="602678457" Received: from ju001lcs02.dfw.the-server.net.au (HELO ju001lcs02.dfw.the-server.com.au) ([175.107.191.11]) by ironport1-mta.cbr1.mail-filtering.com.au with ESMTP; 09 Mar 2012 17:51:52 +1100 Received: from [124.191.162.147] (helo=[192.168.0.12]) by ju001lcs02.dfw.the-server.com.au with esmtpa (Exim 4.69) (envelope-from ) id 1S5tg5-003TVV-8c for internals@lists.php.net; Fri, 09 Mar 2012 17:51:50 +1100 Message-ID: <4F59A8A1.9090800@rotorised.com> Date: Fri, 09 Mar 2012 16:52:17 +1000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [POC - Patch] Scalar Type Hinting - A-La zend_parse_parameters From: lists@rotorised.com (Ryan McCue) Anthony Ferrara wrote: > So, what do you think? I am a big fan of this style. Accepting e.g. "1abc" as int(1) with a notice seems like a better solution than anything else. A full error would be too much towards strict typing (I wouldn't mind personally, but others do have a strong opinion on this, as we've seen). The only thing I'm not so crazy about is foob('abc') -> bool(true). I can live with it, but I don't particularly like it as far as the typing goes. Ilia Alshanetsky wrote: > My concern with this type of patch is that what you are proposing are > not really hints, they are forced casts. As such they modify the data > potentially leading to data loss. I disagree with Ilia on this, as the casts are only made if they can be converted properly, and give E_RECOVERABLE_ERROR instead. Anything that's going to have significant data loss is covered by that. Bottom line: I'd personally use this, while I certainly would not use the previous style (with `(int) $foo` e.g.). -- Ryan McCue