Hi,

Marcus Boerger schrieb:
Trait a {
  function f() {}
}

Trait b {
  function f() {}
}

class c {
  uses a, b;
  function f() {}
}

Reflection(c):
function "\0a\0f"   function a::f
function "\0b\0f"   function b::f
function "f"        function f

All nicely callable using array syntax:
class d extends c {
   function t() {
     call_user_func(array($this, "a::f")):
     call_user_func(array($this, "b::f")):
     call_user_func(array($this, "f")):
   }
}
$o = new c:
$o->test();
May be I don't get the point completly, but having this, every thing what traits are trying to solve is lost... IMHO
Instead, you are playing with the devil (C++ multiple-inheritance).

The main part of the trait idea is to be able to solve conflicts explicitly. Think this is the major contribution of traits and the things being discussed here right now are not THIS kind of traits anymore.

Your other mail from today goes in the same direction. I don't feel comfortable with this :(

I will put together some thoughts on how we could build real traits semantics with the intended benefits you might be a bit more comfortable with.

But I absolutely think the proposals from the last days are going in the wrong direction. Instead of abusing the traits idea for this, it would be a valuable contribution to make a cut and drop the traits ideas for the sake of simplicity and use some mixin mechanism instead.

I'll try to have a better "real trait thing" ready in this evening.

Kind Regards
Stefan

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

Reply via email to