Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34379 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99795 invoked by uid 1010); 4 Jan 2008 00:31:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99778 invoked from network); 4 Jan 2008 00:31:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 00:31:19 -0000 Authentication-Results: pb1.pair.com header.from=sam@sambarrow.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sam@sambarrow.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain sambarrow.com from 205.234.132.11 cause and error) X-PHP-List-Original-Sender: sam@sambarrow.com X-Host-Fingerprint: 205.234.132.11 scottsdale.servershost.net Received: from [205.234.132.11] ([205.234.132.11:58080] helo=scottsdale.servershost.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/E7-20810-55E7D774 for ; Thu, 03 Jan 2008 19:31:17 -0500 Received: from [208.58.196.175] (port=50898 helo=[192.168.1.92]) by scottsdale.servershost.net with esmtpsa (SSLv3:RC4-MD5:128) (Exim 4.68) (envelope-from ) id 1JAaSx-0006hi-F7; Thu, 03 Jan 2008 18:31:15 -0600 To: Stanislav Malyshev Cc: Alexey Zakhlestin , internals@lists.php.net In-Reply-To: <477D66B4.2000107@zend.com> References: <200801031903.01980.tomi@cumulo.fi> <20080103172813.GQ7861@mint.phcomp.co.uk> <477D2B40.9010302@fischer.name> <477D2CDB.3000005@zend.com> <477D452A.9090906@zend.com> <1199392531.15292.64.camel@sbarrow-desktop> <477D4ACF.3030006@zend.com> <1199395138.15292.72.camel@sbarrow-desktop> <477D58ED.6030101@zend.com> <477D66B4.2000107@zend.com> Content-Type: text/plain Date: Thu, 03 Jan 2008 19:31:11 -0500 Message-ID: <1199406671.5889.7.camel@e-vectra> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Antivirus-Scanner: Clean mail though you should still use an Antivirus X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - scottsdale.servershost.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - sambarrow.com X-Source: X-Source-Args: X-Source-Dir: Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: sam@sambarrow.com (Sam Barrow) If foo() is changed, the type hints should be removed. Most of the time however, a function will not change its functionality enough to change the purpose of the arguments. On Thu, 2008-01-03 at 14:50 -0800, Stanislav Malyshev wrote: > > type-hinting is asserting. > > checking of types is needed only on interface-border points (where > > With strict checking, that means instead of calling: > foo($bar); > you'd have now to do: > if(is_integer($bar)) { > // stupid foo() call would blow up if passed not integer, so I have > to manually handle it > // oh wait, actually I don't have any way to handle it - I need > foo() to be called to proceed > // so let's just > die("can't call foo() because \$bar is not integer"); > } > foo($bar); > > Now how it's easier or makes application more stable? What happens if > foo() is changed and now accepts both integers and strings? What happens > if someone forgets to write a wrapper? > -- > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com >