Re: RFC: Traits for PHP
| From: | Marcus Boerger | Date: | Tue, 19 Feb 2008 14:29:30 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35593@lists.php.net to get a copy of this message | ||
Hello Rasmus,
Tuesday, February 19, 2008, 2:45:15 AM, you wrote:
> Larry Garfield wrote:
>> You also note that this mechanism has no runtime impact. That's unfortunate,
>> because I'd find the ability to add methods to an object at runtime
>> conditionally based on some other value far more useful in my work. :-)
>> Especially since, as above, there seems to be a way to implement this
>> functionality now as-is with a little more typing, yet runtime modification
>> is still impossible without eval() and similar scary stuff.
> The idea here is that we want to be able to cache opcodes, classes and
> functions and optimize them out of the runtime context so the executor
> can skip creating classes and functions on every single request. A lot
> of the traffic on this list over the past couple of months seems to
> ignore this basic premise. Features such as autoload and runtime object
> manipulation incur a huge performance hit in the sense that they change
> something that was free before and not only add the cost of the feature
> itself, but it also means the object in question now can no longer be
> cached and has to be created on every single request.
> This doesn't mean we can't consider such features, but people need to
> also consider the performance implications.
For that reason allowing traits in favor of include inside a class body is
much better.
Best regards,
Marcus