Re: RFC: Traits for PHP
| From: | Marcus Boerger | Date: | Tue, 19 Feb 2008 14:34:08 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35596@lists.php.net to get a copy of this message | ||
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