php@stefan-marr.de wrote:
Hi,
[..]
Request for Comments: Traits for PHP
[..]
If it doesn't affect performance MUCH then I'm all for it ! It can
bring better structure for complex designs. Also by reusing, I'm
assuming less memory will be needed for the code base which is beneficial.
- Mark
Hi Mark,
If it doesn't affect performance MUCH then I'm all for it ! It can
bring better structure for complex designs. Also by reusing, I'm
assuming less memory will be needed for the code base which is beneficial.
the current implementation does not save any memory compared to a
user-level copy'n'past solution. But there might be the opportunity to
optimize the op_array handling.
The performance impact is almost the same for a trait usage as for
inheritance or interface definitions. The only costly operation is
copying the method body from the trait to the class where it is used.
But this should be much cheaper than parsing the method for each
single class, what would be necessary if one would use a good old
copy'n'past approach.
Kind Regards
Stefan
Hello Stefan,
a userland copy'n'paste does not allow to reuse already compiled opcodes.
Traits do at least conceptionally.
marcus
Tuesday, February 19, 2008, 1:09:24 PM, you wrote:
Hi Mark,
If it doesn't affect performance MUCH then I'm all for it ! It can
bring better structure for complex designs. Also by reusing, I'm
assuming less memory will be needed for the code base which is beneficial.
the current implementation does not save any memory compared to a
user-level copy'n'past solution. But there might be the opportunity to
optimize the op_array handling.
The performance impact is almost the same for a trait usage as for
inheritance or interface definitions. The only costly operation is
copying the method body from the trait to the class where it is used.
But this should be much cheaper than parsing the method for each
single class, what would be necessary if one would use a good old
copy'n'past approach.
Kind Regards
Stefan
Best regards,
Marcus