Re: function overloading

From: Date: Tue, 15 Nov 2016 20:41:06 +0000
Subject: Re: function overloading
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14  Groups: php.internals 
Request: Send a blank email to internals+get-96898@lists.php.net to get a copy of this message
Hi, Dominic Grostate wrote:
I think this may have been discussed before, but I was largely dismissed because no one though it would be possible to implement. However assuming it is possible, what is the general feeling towards function overloading, as seen in C# and Java?
Personally, I am against it. PHP has optional arguments, and it also has dynamic typing. These together eliminate much of the need for overloading. But there's also the issue of PHP's weak typing. If "123" and 123 dispatch to different methods, that could be a problem. And, generally, I don't think the added complexity is worth it. In my experience, APIs which make heavy use of overloading are not much fun to use. Thanks. -- Andrea Faulds https://ajf.me/

« previous php.internals (#96898) next »