Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34383 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6435 invoked by uid 1010); 4 Jan 2008 00:47:10 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6420 invoked from network); 4 Jan 2008 00:47:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jan 2008 00:47:10 -0000 Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 213.152.38.186 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 213.152.38.186 freshmint.phcomp.co.uk Linux 2.5 (sometimes 2.4) (4) Received: from [213.152.38.186] ([213.152.38.186:61553] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/19-20810-D028D774 for ; Thu, 03 Jan 2008 19:47:10 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.67) (envelope-from ) id 1JAaiI-0000dS-6S; Fri, 04 Jan 2008 00:47:06 +0000 Date: Fri, 4 Jan 2008 00:47:06 +0000 To: Stanislav Malyshev Cc: Markus Fischer , internals@lists.php.net Message-ID: <20080104004706.GX7861@mint.phcomp.co.uk> References: <200801031903.01980.tomi@cumulo.fi> <1199380881.15292.11.camel@sbarrow-desktop> <20080103172813.GQ7861@mint.phcomp.co.uk> <477D2B40.9010302@fischer.name> <477D2CDB.3000005@zend.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <477D2CDB.3000005@zend.com> User-Agent: Mutt/1.4.1i Organization: Parliament Hill Computers Ltd Subject: Re: [PHP-DEV] RE: Optional scalar type hinting From: addw@phcomp.co.uk (Alain Williams) On Thu, Jan 03, 2008 at 10:43:39AM -0800, Stanislav Malyshev wrote: > >When the type hint says I want an integer, then only integer should be > >accepted; no casting should be done. It may give predictable results > > Why people that want Java just don't use Java I wonder? PHP never was a > strict static typed language. You aren't making it a strict static typed language. All that you are doing is saying that at certain points (function entry) that the values are checked and converted to certain types. If within the fuction an argument hinted as integer is used in a string context, the juggling will still happen. What you are doing to allowing the function author to protect the integrity of his code without having to resort to a regex/... to check what the arguments are. -- Alain Williams Linux Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php Chairman of UKUUG: http://www.ukuug.org/ #include