Hello Stefan,

  so at th eend of the day users will get renaming and will abuse it.
That said I am wondering if at the beginning we might want to do Traits
without aliasing and dropping. If we feel it gets necessary we probbaly
might want to support a syntax like:
  'trait_method' => false
  'trait_method' => 'new_name'
  'trait_method' => array('new_name', 'trait_method'

I am suggesting this because it is more what people expect to find. And it
is easier to understand imo.

marcus

Tuesday, February 19, 2008, 10:59:20 PM, you wrote:

> Hi Evert,

>> Aliasing doesn't make a lot of sense, as you can always :
>>
>> function newMethod() {
>>   return $this->oldMethod();
>> }

> Don't think so.
> You do use aliasing to handle conflicts and in the case of a conflict
> there is no oldMethod.

> trait A {
>   public function foo() {echo 'foo';}
> }

> trait B {
>   public function foo() {echo 'fooBar';}
> }

> class MyClass {
>   use A;
>   use B {
>     !foo, fooBar => foo
>   }
> }

> The result will be at runtime:

> class MyClass {
>   public function foo() {echo 'foo';}
>   public function foo() {echo 'fooBar';}
> }

> Here you can't do something like this:

> class MyClass {
>   use A;
>   use B;
> }

> since eventually there wont be any method in MyClass.




Best regards,
 Marcus

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

Reply via email to