Re: function overloading
| From: | Stanislav Malyshev | Date: | Tue, 22 Nov 2016 03:54:20 +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-97113@lists.php.net to get a copy of this message | ||
Hi!
On 11/15/16 8:13 AM, 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?
Please no. It wouldn't do well in PHP.
> To me, it saves me coming up with convoluted names for tackle various
> parameter combinations, even though the function/methods themselves all do
Don't come up with convoluted names, come up with names that describe
what the function actually does. If it's too convoluted, maybe it should
be refactored to simplify it. Naming functions doing different things by
the same name is a recipe for an unreadable and unmaintainable code.
--
Stas Malyshev
smalyshev@gmail.com