Re: AW: [PHP-DEV] Method overloading by method signature

From: Date: Sun, 14 Oct 2007 12:26:47 +0000
Subject: Re: AW: [PHP-DEV] Method overloading by method signature
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-32756@lists.php.net to get a copy of this message
Marcus Boerger wrote:
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.
Am I the only here who thinks that performance is not the major issue with this approach? Method signatures lead to a different style of programming I personally wouldn't want to encourage in PHP. I'm expecting some kind of "if you don't like it don't use it" answer but I wouldn't want to bloat the language for such a feature anyway. Example: It's too easy for someone to think it's a good idea to change function foo($x) { ... } to something like function foo(string $x) { ... } function foo(int $x) { ... } but this can lead to very subtle bugs as automatic type conversion can trick you into passing something different than you thought and hence could lead you to do foo(strval($x)); all over the place to not get any surprises. A Bad Thing(TM) IMHO. Regards, - Chris

« previous php.internals (#32756) next »