Re: Opinion on function/method name overloading
| From: | Christoph Becker | Date: | Mon, 06 Jun 2016 13:17:04 +0000 |
| Subject: | Re: Opinion on function/method name overloading | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-93843@lists.php.net to get a copy of this message | ||
Dominic Grostate wrote:
> As I understand it, using Java-like function overloading in PHP is
> undesirable due to hindrance in readability.
>
> However I'd like to get an opinion on whether it would be received more
> favourably if it could provide an actual performance enhancement over hand
> managed implementation's of detecting argument differences with variadic
> and func_get_args.
>
> On to a more subjective argument, "naming things" is hard, and I think many
> people would appreciate being able to reuse function/method names without
> sacrificing type safety.
Another issue besides what has already been mentioned in other replies
is that PHP already has the concept of overloading[1]:
| Overloading in PHP provides means to dynamically "create" properties
| and methods. These dynamic entities are processed via magic methods
| one can establish in a class for various action types.
So at least another name would have to be chosen for either of both
concepts.
[1] <http://php.net/manual/en/language.oop5.overloading.php>
--
Christoph M. Becker