Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32765 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62745 invoked by uid 1010); 14 Oct 2007 21:14:07 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 62730 invoked from network); 14 Oct 2007 21:14:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2007 21:14:07 -0000 Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:56013] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D9/0A-02105-C9682174 for ; Sun, 14 Oct 2007 17:14:07 -0400 Received: from MBOERGER-ZRH.corp.google.com (c-24-6-174-47.hsd1.ca.comcast.net [24.6.174.47]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 345791B361F; Sun, 14 Oct 2007 23:13:57 +0200 (CEST) Date: Sun, 14 Oct 2007 23:13:53 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <19939840.20071014231353@marcus-boerger.de> To: "Hans Moog" CC: "Marcus Boerger" , internals@lists.php.net In-Reply-To: <7C37FF3A0196094F95430BA95952032211B7CC@s1.mkj.lan> References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> <72129346.20071014092922@marcus-boerger.de> <7C37FF3A0196094F95430BA95952032211B7CC@s1.mkj.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Method overloading by method signature From: helly@php.net (Marcus Boerger) Hello Hans, Sunday, October 14, 2007, 1:11:35 PM, you wrote: > I will do so, but i will have to modify it to work with the current php > version and I wanted to know if everybody hates this way of method overloading first. > Btw: We made some benchmark tests when we decided to use it. And the > method calls were about 0.1 Percent slower. But without having to check or > escape every parameter anymore it even boosts performance for us, since we > really try to build very robust applications and because of that check all > parameters that could be problematic. > But if you write quick and dirty code without thinking about sql > injections or other problems and not checking anyhting, it is definitly a > bit slower (about 0.1 percent of a normal method call). > But I think this loss of performance is worth it since the current way of > php's mixture of strict OO + traditional loose typing is really shooting > PHP in the foot. (Nobody will ever really use typehinting when he want's > to offer a number of ways to use a method). Reading this it occurs to me that you are on a completely wrong track. PHP is untyped for a good reason. It was a choice to deal with the untyped web environment. Later we added type hints to help code readability. Yet OOP is only a small apspect of PHP and always will be. That said the language for you would probably have another one. Also type hinting and overloading do not in any way free you from filtering and escaping. If you think so you may test your code again and hopefuly not find too many security holes. The reason I asked for performance impact is that in general we do not like to add features that are not necessary for the web environment but have a negative impact on it. Also reading of an impact of 0.1 percent seems very strange as basically anything below 2% is close to the measurable limit and the onlt way to measure such tiny impacts would be counting assembled instructions using callgrind. Last but not least we added typehints to enable developers to generate better understandable error messages. These go especially well with the typical easy PHP application designs and PHPs stack trace ability in exception handling. marcus