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). -----Ursprüngliche Nachricht----- Von: Marcus Boerger [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 14. Oktober 2007 09:29 An: Hans Moog Cc: Alexey Zakhlestin; internals@lists.php.net Betreff: Re: AW: [PHP-DEV] Method overloading by method signature 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:[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> wrote: >> Will method overloading by method signature be implemented in php6 or >> even php 5.3? >> >> >> >> Example: >> >> <?php >> >> 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 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php