Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32776 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62547 invoked by uid 1010); 15 Oct 2007 12:36:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 62532 invoked from network); 15 Oct 2007 12:36:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Oct 2007 12:36:31 -0000 Authentication-Results: pb1.pair.com header.from=salsi@icosaedro.it; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=salsi@icosaedro.it; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain icosaedro.it from 88.149.172.234 cause and error) X-PHP-List-Original-Sender: salsi@icosaedro.it X-Host-Fingerprint: 88.149.172.234 88-149-172-234.static.ngi.it Linux 2.4/2.6 Received: from [88.149.172.234] ([88.149.172.234:32920] helo=icosrv.icosaedro.it) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/91-39149-DCE53174 for ; Mon, 15 Oct 2007 08:36:30 -0400 Received: from icosrv (localhost [127.0.0.1]) by icosrv.icosaedro.it with SMTP id l9FCaPIf014853 for ; Mon, 15 Oct 2007 14:36:25 +0200 Message-ID: <200710151236.l9FCaPIf014853@icosrv.icosaedro.it> Date: Mon, 15 Oct 2007 14:00:50 CEST User-Agent: tt v. 1.0.5; www.icosaedro.it/tt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 In-Reply-To: <4712731B.5070501@zend.com> References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C8@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7CB@s1.mkj.lan> <4712731B.5070501@zend.com> To: internals@lists.php.net Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: salsi@icosaedro.it (Umberto Salsi) Posting to newsgroup php.internals, you wrote: > > But if you want to be more strict and limit the coder to use your > > functions only with a specific parameter signature (and thats the > > The purpose of signature overloading in most languages isn't input type > control, it's different functionality on different types. However, > unlike many other languages, PHP does not have static typing, and that > would not allow to know which function is called immediately, only at > runtime. This has both performance impact and code transparency impact - > you wouldn't know which function will be called until runtime. I am not > convinced this added complexity serves any real need - though you are > welcome to prove otherwise, i.e. present some use case when one can't do > without signature overloading. > > > only reason to use type hints - to ensure the method is used > > correctly and build more robust applications), it is better to tell > > BTW, I'm not sure how exactly it makes the code more robust - if you > call it with wrong type and it's not checked, the app would probably die > on fatal error. If you call it with wrong type and it is checked, the > app would die on fatal error couple of lines above. Unless you use some > kind of static analysis tool to verify your app prior to deployment (if > you know such tools please tell me!) I don't see much difference here, > mostly syntax sugar and enforcing right style (which is not bad - just > it's not that big a deal). > > > lost in this move (boo!). No longer can you override a method & > > provide an incompatible signature. This mixture of strict OO + PHP's > > traditional loose typing is really shooting PHP in the foot. > > If you don't want strict signatures - why you are using them? Nobody > forces you to type your arguments. And inheritance is certainly not for > overriding objects with incompatible signatures, if you try to do it you > are misusing it. > > > I think, that this ist the reason why nearly nobody uses this great > > new feature (to ensure that the passed parameters are correct), > > The above statement is not true. This feature is used by many > developers. Please stop using "unless you do it my way, nobody will use > PHP" argument - it doesn't work. > -- > Stanislav Malyshev, Zend Software Architect > stas@zend.com http://www.zend.com/ > (408)253-8829 MSN: stas@zend.com Ciao, ___ /_|_\ Umberto Salsi \/_\/ www.icosaedro.it