Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34441 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8535 invoked by uid 1010); 4 Jan 2008 18:33:56 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8519 invoked from network); 4 Jan 2008 18:33:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 18:33:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=stas@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stas@zend.com; 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:29529] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/4B-63281-31C7E774 for ; Fri, 04 Jan 2008 13:33:56 -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 20:33:51 +0200 Received: from [192.168.16.90] ([192.168.16.90]) by us-ex1.zend.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 4 Jan 2008 10:33:48 -0800 Message-ID: <477E7C0D.1010008@zend.com> Date: Fri, 04 Jan 2008 10:33:49 -0800 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Robert Cummings CC: internals Mailing List References: <477DB7BF.10201@chiaraquartet.net> <20080104105558.GC7861@mint.phcomp.co.uk> <477E5649.2080104@chiaraquartet.net> <1463438959.20080104182050@marcus-boerger.de> <1199468241.6629.53.camel@blobule> In-Reply-To: <1199468241.6629.53.camel@blobule> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 04 Jan 2008 18:33:48.0816 (UTC) FILETIME=[58C81100:01C84F00] Subject: Re: [PHP-DEV] type hinting From: stas@zend.com (Stanislav Malyshev) > IMHO, optionally inclusion of type hinting for functions/methods can > only be a boon to code quality and readability. IMHO when a type hint is > provided and a parameter doesn't match the type hint then I think a > fatal error should occur. This forces the user of the function that has So you code could blow up in random places in production because somebody wrote a plugin that called a typehinted class with wrong variable type (and remember, PHP has no variable typing, so you have no idea what type of the variable is in each particular place) without properly wrapping it. > type hinting to ensure their data is of the correct type. This prevents Doing this how? Without full variable typing and static type control you can not do it. > accidental wrong data conversion. However, I see the other side of the No, it doesn't. It makes your application blow up on data conversion. I would prefer having '1' converted to 1 instead of having my application fail. > function foo( require int $a, require string $b ){} So now we have 2 additional syntaxes instead of one... -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com