Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44648 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 37191 invoked from network); 2 Jul 2009 13:29:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2009 13:29:29 -0000 Authentication-Results: pb1.pair.com header.from=ilia@ilia.ws; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ilia@ilia.ws; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ilia.ws designates 72.14.220.155 as permitted sender) X-PHP-List-Original-Sender: ilia@ilia.ws X-Host-Fingerprint: 72.14.220.155 fg-out-1718.google.com Received: from [72.14.220.155] ([72.14.220.155:58365] helo=fg-out-1718.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/74-16153-836BC4A4 for ; Thu, 02 Jul 2009 09:29:29 -0400 Received: by fg-out-1718.google.com with SMTP id 13so1130887fge.0 for ; Thu, 02 Jul 2009 06:29:24 -0700 (PDT) Received: by 10.86.94.7 with SMTP id r7mr210419fgb.11.1246541364851; Thu, 02 Jul 2009 06:29:24 -0700 (PDT) Received: from ?192.168.1.169? (TOROON63-1176059019.sdsl.bell.ca [70.25.60.139]) by mx.google.com with ESMTPS id 4sm13833176fge.23.2009.07.02.06.29.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 02 Jul 2009 06:29:23 -0700 (PDT) Cc: Lukas Kahwe Smith , Paul Biggar , PHP Internals , Derick Rethans , Stanislav Malyshev , Hannes Magnusson Message-ID: <8FC81E2C-8E83-41F8-9C89-B3E60CCFBB3A@ilia.ws> To: Robert Cummings In-Reply-To: <4A4CB4BC.90101@interjinn.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v935.3) Date: Thu, 2 Jul 2009 09:29:20 -0400 References: <4A4CB074.1010000@interjinn.com> <4A4CB4BC.90101@interjinn.com> X-Mailer: Apple Mail (2.935.3) Subject: Re: [PHP-DEV] Re: Flexible type hinting From: ilia@ilia.ws (Ilia Alshanetsky) On 2-Jul-09, at 9:23 AM, Robert Cummings wrote: > Ilia Alshanetsky wrote: >> On 2-Jul-09, at 9:04 AM, Robert Cummings wrote: >>> Ilia Alshanetsky wrote: >>> >>>> Paul's proposal is some part does not make sense because it >>>> allows weak type hinting, which should not be used if you need >>>> type hinting. The whole idea about type hinting is definition >>>> of strict interfaces, not loosely based one. That's just my >>>> opinion, which admittedly I feel fairly strongly about. >>> It's a hint, not enforcement. IMHO hinting about something is not >>> strict, it's a suggestion. >> Have you using existing array or class type hinting? > > I have, and IMHO it makes more sense for strict checking (though not > too strict since super classes make sense) when objects are being > passed. But in the case of primitive datatypes where coercion > between types is well established and understood, I think it should > be a warning. PHP knows how to convert the string '1' to integer. It > knows how to convert 0 to boolean false. These were established many > years ago. On the other hand PHP does not know how to coerce (in a > sensible way) class FreakyDeaky to class GobbletyGoot. It is not about what PHP can convert, in the past and if you use old function parameter parsing api PHP will even convert arrays to stirngs. Its about delivering to the function/method exactly what it wants and not a close facsimile thereof.