Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44651 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44707 invoked from network); 2 Jul 2009 13:45:38 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jul 2009 13:45:38 -0000 Authentication-Results: pb1.pair.com smtp.mail=robert@interjinn.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=robert@interjinn.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain interjinn.com from 66.11.173.122 cause and error) X-PHP-List-Original-Sender: robert@interjinn.com X-Host-Fingerprint: 66.11.173.122 unknown Received: from [66.11.173.122] ([66.11.173.122:56203] helo=interjinn.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CA/64-16153-C74BC4A4 for ; Thu, 02 Jul 2009 09:22:05 -0400 Received: by interjinn.com (Postfix, from userid 5001) id 9713C38C113; Thu, 2 Jul 2009 09:21:54 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on gruknuk.suds X-Spam-Level: X-Spam-Status: No, score=-4.4 required=7.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 Received: from [192.168.1.3] (blobbie [192.168.1.3]) by interjinn.com (Postfix) with ESMTPS id 93C7138C043; Thu, 2 Jul 2009 09:21:53 -0400 (EDT) Message-ID: <4A4CB4BC.90101@interjinn.com> Date: Thu, 02 Jul 2009 09:23:08 -0400 Organization: InterJinn User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: Ilia Alshanetsky CC: Lukas Kahwe Smith , Paul Biggar , PHP Internals , Derick Rethans , Stanislav Malyshev , Hannes Magnusson References: <4A4CB074.1010000@interjinn.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: Flexible type hinting From: robert@interjinn.com (Robert Cummings) 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. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP