Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37092 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24793 invoked from network); 17 Apr 2008 17:16:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2008 17:16:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 208.70.128.105 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 208.70.128.105 smtp-gw79.mailanyone.net Received: from [208.70.128.105] ([208.70.128.105:55780] helo=smtp-gw79.mailanyone.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/A9-05127-A0687084 for ; Thu, 17 Apr 2008 13:16:58 -0400 Received: from mailanyone.net by smtp-gw79.mailanyone.net with esmtpsa (TLSv1:RC4-MD5:128) (MailAnyone extSMTP sam@sambarrow.com) id 1JmXjD-0007Fx-Nr; Thu, 17 Apr 2008 12:16:55 -0500 To: Stanislav Malyshev Cc: Paul Biggar , Felipe Pena , internals@lists.php.net In-Reply-To: <4807837A.3030700@zend.com> References: <1208404255.5665.34.camel@pena> <1208440873.32403.6.camel@sbarrow-desktop> <4807837A.3030700@zend.com> Content-Type: text/plain Date: Thu, 17 Apr 2008 13:14:32 -0400 Message-ID: <1208452472.6148.11.camel@sbarrow-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Type hints (parameter and return value) From: sam@sambarrow.com (Sam Barrow) On Thu, 2008-04-17 at 10:06 -0700, Stanislav Malyshev wrote: > 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 :) I understand it very well, but why have a whole other system of type juggling? That would be duplicating type juggling functionality that's already in there.