Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:44930 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11675 invoked from network); 10 Jul 2009 17:58:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jul 2009 17:58:22 -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 63.205.162.117 as permitted sender) X-PHP-List-Original-Sender: stas@zend.com X-Host-Fingerprint: 63.205.162.117 us-mr1.zend.com Linux 2.4/2.6 Received: from [63.205.162.117] ([63.205.162.117:35488] helo=us-mr1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 27/90-37812-E31875A4 for ; Fri, 10 Jul 2009 13:58:22 -0400 Received: from us-gw1.zend.com (us-ex1.zend.net [192.168.16.5]) by us-mr1.zend.com (Postfix) with ESMTP id 36E06E12BB; Fri, 10 Jul 2009 10:47:01 -0700 (PDT) Received: from [192.168.16.83] ([192.168.16.83]) by us-gw1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 10 Jul 2009 10:59:02 -0700 Message-ID: <4A57813C.8020502@zend.com> Date: Fri, 10 Jul 2009 10:58:20 -0700 Organization: Zend Technologies User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Lukas Kahwe Smith CC: Lewis Wright , Alain Williams , "Ionut G. Stan" , internals@lists.php.net References: <7.0.1.0.2.20090708224156.0ac5a438@zend.com> <312025EF-84D0-4411-A0A7-4F0379C3105F@pooteeweet.org> <22CAD497EA2F476DAECEF9302D0B087A@pc> <98b8086f0907091150r47e7a103jaa50fcf7d5b32186@mail.gmail.com> <4A568B33.9000501@gmail.com> <98b8086f0907091744w7ab598dckc427d0a9484664b2@mail.gmail.com> <20090710102302.GC20283@gerbil.thgnet.it> <4A571981.80900@gmail.com> <20090710110522.GD19636@mint.phcomp.co.uk> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 10 Jul 2009 17:59:02.0796 (UTC) FILETIME=[1BDA6CC0:01CA0188] Subject: Re: [PHP-DEV] Type hinting - Request for Discussion From: stas@zend.com (Stanislav Malyshev) Hi! > right .. lets not forget the original goal (though it hasnt been > perfectly defined) > the idea was to move common validation code out of the function body to > reduce code, increase readability and enable IDE's to be even smarter. I think while intent is good (avoiding repetitive code) the strict implementation would do exactly the opposite of what should be done - it would move the repeated validation from library code to client code. WHich would negatively influence both readability (in case you do it right) and code robustness (in case you forget to do the necessary checks). > the point is not flexibility, its finding a sensible common denominator > for validation of input parameters and optimizing the syntax for that case. Why the point can't be flexibility? And if we talk about common denominator, how many use cases must accept 1, but not '1' or '1.0'? How many use cases can accept float, but can't accept integer? How many use cases need boolean but can't accept 0? How many use cases need string, but should never accept object with working toString() like SimpleXML element? I don't see many such cases now. Do you? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com