Hi Nikita.

Thanks for your response and the links. I found the search engine you linked to working well.

The reason I came to think of this issue was not as much to be able to do function overloading in general, but more from the fact that the discussion on operator overloading seemed to involve a lot of struggling trying to get it right when it comes to not preventing others from adding operator overloads for your classes, and so on, and free functions that can be overloaded provides in my opinion an elegant solution to this.

The method using __call() given in the last article unfortunately doesn't work for free function overloading, since it only works for methods, and we're back to the question: Which class can or should provide an overload if you have two different types of operands?

I also understand that PHP's dynamically typed system makes a difference compared to statically typed languages like C++ or Java.

Given this reality, I guess the current userland operator overloading proposal may be the best we can hope for, and I for one would appreciate any kind of operator overloading to none at all.

Regards,

Terje

Please excuse me if this has been discussed to death earlier. I've
tried
to search for it, but I've come up empty:
https://www.php.net/results.php?
q=function+overloading&l=en&p=all
Yes, this has already been discussed to death. The search on php.net
does not extend to the mailing list archives. You may find
https://externals.io/ or
https://markmail.org/search/?q=list%3Anet.php.lists.internals more
useful for that purpose.

https://github.com/Danack/RfcCodex/blob/master/method_overloading.md
provides a very high level summary on the topic.

There's very little I'm sure about when it comes to the future of PHP,
but one of the things I can state with some degree of conviction is
that we will never introduce type-based method overloading.



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to