On 4 December 2017 17:26:12 GMT+00:00, Levi Morrison <le...@php.net> wrote:
> Using `T::get as get2` still conflicts because that
>*aliases* even though most literature says it renames.

Funnily enough, I was just recently wondering why exactly that was, and 
couldn't find much of an answer. The RFC rather vaguely says that it would 
cause problems with dynamic dispatch, but it's not obvious to me why using 
"insteadof" to replace an inherited or locally declared method would be any 
different from using it to choose between two traits.

However, even if that limitation wasn't present, I can't see a use case for 
*directly* using the same trait twice in one class. I say directly, because 
even now you can *indirectly* introduce a trait twice, via inheritance of 
either the class or the trait.

trait A { function foo() {} }
trait B { use A; function bar() {} }
trait C { use A; function baz() {} }
class X {
 use B, C { B::foo insteadof C; }
}
class Y extends X {
 use A;
}

Regards,

-- 
Rowan Collins
[IMSoP]

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

Reply via email to