Re: Opinion on function/method name overloading

From: Date: Mon, 06 Jun 2016 10:55:27 +0000
Subject: Re: Opinion on function/method name overloading
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-93837@lists.php.net to get a copy of this message
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 itself. A quick example off the top of my head (there are many other edge cases to cover): class A { public function foo($bar) { echo 0; } public function foo(string $bar) { echo 1; } public function foo(int $bar) { echo 2; } } class B extends A { public function foo(float $bar) { echo 3; } } (new A)->foo(1.5); (new B)->foo(1.5); Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#93837) next »