Just stumbled over a
proposal for traits in PHP, proposed by
Stefan Marr. Being a bit sceptical at first I came to the conclusion that this would be a really useful feature - and save us a bunch of doubled code in Stubbles. After reading the RFC until the end I noticed that I saw a similar concept some weeks before in Java:
Qi4J tries to achieve the same, but requires very much code to get this done. As a language construct within PHP it would be very easy to do the same, but easier to learn and to use. Beside some keyword issues (the RFC uses "use" as keyword, but this will of course conflict with
namespaces) I'm wondering what this will have an impact on reflection - the RFC stays unclear about this. What do I get when reflecting a method from a trait, or a method in a class that originally comes out of a trait?
However I'm not very confident that this feature will make its way into PHP - maybe I've read to much internals...
On the Stubbles blog, Frank Kleine has pointed out a proposal ...
Tracked: Feb 20, 15:37