Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37087 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16138 invoked from network); 17 Apr 2008 17:06:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2008 17:06:10 -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:35510] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/C7-05127-18387084 for ; Thu, 17 Apr 2008 13:06:10 -0400 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 17 Apr 2008 20:06:52 +0300 Received: from [192.168.16.217] ([192.168.16.217]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 17 Apr 2008 10:06:48 -0700 Message-ID: <4807837A.3030700@zend.com> Date: Thu, 17 Apr 2008 10:06:02 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: Sam Barrow CC: Paul Biggar , Felipe Pena , internals@lists.php.net References: <1208404255.5665.34.camel@pena> <1208440873.32403.6.camel@sbarrow-desktop> In-Reply-To: <1208440873.32403.6.camel@sbarrow-desktop> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 17 Apr 2008 17:06:48.0921 (UTC) FILETIME=[6C714C90:01C8A0AD] Subject: Re: [PHP-DEV] [RFC] Type hints (parameter and return value) From: stas@zend.com (Stanislav Malyshev) Hi! > The problem with this is that there's not much point in converting the > value. PHP will do that anyway, making this kind of pointless. There would be a point since PHP might convert to different type that you intended. Think of $foo = "My age is $age". If $age is supposed to be int, then converting int hint might help. > Overall, I think type hinting should work by checking the type. If it > does not match, raise an error. For example, int means int, not numeric > string. What code scenario would make it necessary to distinguish between number stored as string and number stored as binary? > This only serves to include an additional type juggling system into php, > which is very confusing. There's already type juggling in PHP, and if you find it confusing, you find whole PHP and whole set of dynamic languages very confusing. I guess maybe C or Java would work better then :) -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com