Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32752 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98297 invoked by uid 1010); 14 Oct 2007 07:29:31 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 98282 invoked from network); 14 Oct 2007 07:29:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2007 07:29:31 -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:39808] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CF/15-47106-955C1174 for ; Sun, 14 Oct 2007 03:29:31 -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 E8B071B34B2; Sun, 14 Oct 2007 09:29:25 +0200 (CEST) Date: Sun, 14 Oct 2007 09:29:22 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <72129346.20071014092922@marcus-boerger.de> To: "Hans Moog" CC: "Alexey Zakhlestin" , internals@lists.php.net In-Reply-To: <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> References: <7C37FF3A0196094F95430BA95952032211B7C5@s1.mkj.lan> <7C37FF3A0196094F95430BA95952032211B7C7@s1.mkj.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: AW: [PHP-DEV] Method overloading by method signature From: helly@php.net (Marcus Boerger) Hello Hans, If you have such a patch you should definitively post it here so that we can hve a look. Most interesting to us is however the oerformance impact. As that was the main reason to go any further than adding return type hints. marcus Saturday, October 13, 2007, 10:47:23 PM, you wrote: > Why would it be incompatible with php's dynamic nature? (I already heard > many people saying "that this is not the php way") But why ? Don't you > like it or do you think it is just not possible to be implemented in php? > I could provide a patch that makes it possible (even with complete > visibility and inheritance rules). We already use it and it saves us a lot of code. > I think it is better than the '$x = "defaultValue"' kind of way to accept > different count and types of parameters because it is MUCH more expressive and intuitive. > It wouldn't even break backward compatibility beause it is just > "syntactical sugar" to checking the variable types manually and then dispatching to the right behaviour. > -----Ursprüngliche Nachricht----- > Von: Alexey Zakhlestin [mailto:indeyets@gmail.com] > Gesendet: Samstag, 13. Oktober 2007 22:22 > An: Hans Moog > Cc: internals@lists.php.net > Betreff: Re: [PHP-DEV] Method overloading by method signature > Hans, such overloading would be incompatible with php's dynamic nature > As far as I remember, even type-hinting for basic-types (strings, > integers) was rejected > On 10/13/07, Hans Moog wrote: >> Will method overloading by method signature be implemented in php6 or >> even php 5.3? >> >> >> >> Example: >> >> > >> namespace xyz; >> >> >> >> import core::TestClass; >> >> >> >> class Test extends TestClass { >> >> public string function test(integer $int) { >> >> return "Hi"; >> } >> >> >> >> public integer function test(string $string, integer $int) { >> >> return $int; >> } >> } >> >> ?> >> >> >> >> I think this would be a very big advantage and would help developers to >> write better code. >> >> Best regards, Marcus