Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
Yes, I can see what you mean. Should a float prefer a string or an int? I don't know. That would be a issue unless an additional method of prioritising were involved. Perhaps if attributes get in there will be a solution: <> function foo(int $a) {} <> function foo(string $a) {} Yet as complic

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Rowan Collins
On 06/06/2016 12:06, Dominic Grostate wrote: float, int and string all share the same row on an upside down pyramid, with $bar, being dynamic, at the bottom. OK, so take away the dynamic case, and assume the caller is in weak mode. Now you have a second case where you need priorities between

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
In your example, the output may be: 0 3 float, int and string all share the same row on an upside down pyramid, with $bar, being dynamic, at the bottom. With regards to union types, it could work exactly like the latest Multi-Catch feature. On 6 Jun 2016 11:57 a.m., "Rowan Collins" wrote: > On

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Rowan Collins
On 06/06/2016 11:32, Christoph Becker wrote: And we would run into similar issues as with the union types with regard to weak typing. This is probably the biggest hurdle, IMO - regardless of the internal implementation, you've got to define exactly how the feature would work in the language i

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Christoph Becker
Derick Rethans wrote: > On Mon, 6 Jun 2016, Dominic Grostate wrote: > >> As I understand it, using Java-like function overloading in PHP is >> undesirable due to hindrance in readability. > > Besides it impacting, readability, it will also create a large impact on > performance. > > Right now,

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
Well I had given some thought to that :) Instead of using mangled names and calculating the canonical name at runtime, keep the name, but convert the function hashtable from a table of op arrays into a table linked lists, of op arrays. A non-overloaded function would be the only element in its li

Re: [PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Derick Rethans
On Mon, 6 Jun 2016, Dominic Grostate wrote: > As I understand it, using Java-like function overloading in PHP is > undesirable due to hindrance in readability. Besides it impacting, readability, it will also create a large impact on performance. Right now, functions (and methods) are looked up

[PHP-DEV] Opinion on function/method name overloading

2016-06-06 Thread Dominic Grostate
Hi, 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 detect