Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34362 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49424 invoked by uid 1010); 3 Jan 2008 22:01:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 49407 invoked from network); 3 Jan 2008 22:01:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jan 2008 22:01:46 -0000 Authentication-Results: pb1.pair.com smtp.mail=tomi@cumulo.fi; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=tomi@cumulo.fi; sender-id=unknown Received-SPF: error (pb1.pair.com: domain cumulo.fi from 81.228.11.120 cause and error) X-PHP-List-Original-Sender: tomi@cumulo.fi X-Host-Fingerprint: 81.228.11.120 pne-smtpout3-sn1.fre.skanova.net Solaris 10 (beta) Received: from [81.228.11.120] ([81.228.11.120:43621] helo=pne-smtpout3-sn1.fre.skanova.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/EE-20810-A4B5D774 for ; Thu, 03 Jan 2008 17:01:46 -0500 Received: from [192.168.1.3] (84.250.46.16) by pne-smtpout3-sn1.fre.skanova.net (7.3.129) (authenticated as kaisto-9) id 474FCCB0001936EF for internals@lists.php.net; Thu, 3 Jan 2008 23:00:49 +0100 Organization: Cumulo Studio To: internals@lists.php.net Date: Thu, 3 Jan 2008 23:59:10 +0200 User-Agent: KMail/1.9.7 References: <200801031903.01980.tomi@cumulo.fi> <1199395138.15292.72.camel@sbarrow-desktop> <477D58ED.6030101@zend.com> In-Reply-To: <477D58ED.6030101@zend.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200801032359.11029.tomi@cumulo.fi> Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: tomi@cumulo.fi (Tomi Kaistila) > So now to use such function you'd have to check your variables for > typing - otherwise your application blows up. And the type-checking > should be total - otherwise you miss some call to some function or some > code path bringing wrong value and your application blows up at runtime > - since static type checking is not available. 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, PHP handles type juggling on its own but it is not magic wand that makes caring for the data type of your variables meaningless. > Meaning, unless all of > your code is type-enforced, you'd have to write a wrapper around each > type-enforced function manually checking that wrong value didn't get in. > But you can do the same checks now, so what is the added value? 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 course not, remove the need to validate your arguments completely. But it would be a big help. Tomi Kaistila PHP Developer