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" <rowan.coll...@gmail.com> wrote:

> 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]
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to