News for hackers. Stuff that matters.
Re:PHP 5.4.0 released by tabbyjabby on Thursday March 01, 2012 @05:27PM (#3654387)
Really looking forward to traits. We have some hacks using interfaces and __call that we have been using to try and approximate traits, but the real thing is always much better. :)
Re:PHP 5.4.0 released by maratd on Thursday March 01, 2012 @06:02PM (#3654528)
Same here. This is a move away from inheritance to mixins. They did a stellar job with it and it's really flexible. Check out http://us2.php.net/traits for the nitty-gritty.
Re:PHP 5.4.0 released by roel_v on Friday March 02, 2012 @03:18AM (#3655851)
I've used traits a few times and in each case replaced it later by either inheritance or moving the functionality into separate classes. I'm not getting the design considerations that call for traits over alternatives. How would one use, and why is it the better option?
Re:PHP 5.4.0 released by nolok on Friday March 02, 2012 @05:35AM (#3656131)
Amongst other things, traits are a way to provide interface delegation. Imperfect, but a lot better than the current solutions.