Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34367 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63102 invoked by uid 1010); 3 Jan 2008 22:42:22 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63087 invoked from network); 3 Jan 2008 22:42:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2008 22:42:22 -0000 Authentication-Results: pb1.pair.com header.from=stas@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:16915] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3D/41-20810-DC46D774 for ; Thu, 03 Jan 2008 17:42:22 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 4 Jan 2008 00:42:18 +0200 Received: from [192.168.16.90] ([192.168.16.90]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 3 Jan 2008 14:42:15 -0800 Message-ID: <477D64C7.9000200@zend.com> Date: Thu, 03 Jan 2008 14:42:15 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Tomi Kaistila CC: internals@lists.php.net References: <200801031903.01980.tomi@cumulo.fi> <1199395138.15292.72.camel@sbarrow-desktop> <477D58ED.6030101@zend.com> <200801032359.11029.tomi@cumulo.fi> In-Reply-To: <200801032359.11029.tomi@cumulo.fi> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Jan 2008 22:42:15.0191 (UTC) FILETIME=[E342A270:01C84E59] Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: stas@zend.com (Stanislav Malyshev) > Unless you are aware of the type of your variables and the data they contain > as you write your applications, you are only inviting trouble anyway. Yes, If you think so, you should use statically typed languages, why invite trouble from the start? > The one I mentioned not so long ago, or we you not paying attention? Having > the type hinted on the function declaration saves me the time and energy of > checking the type myself, which is something I have to do quite often. It, of Maybe you should write your code differently, so that you shouldn't check it so often. I just checked in Zend Framework source - which is not a small body of code - is_integer is used in capacity you want to use typehints (i.e. "this type or error out") only twice, and in both cases I'm not sure it's needed. is_float is not used even once, and is_string I found used only three times in this way, all IMHO unnecessary since simple (string) would work. It could make at least minimal sense to make it converting - but making it type-strict just makes your application blow up in different, less expected, places without actually saving you any time on coding. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com