Hi,
Andi Gutmans schrieb:
I don't think so. I think the value here is not copy&paste but to be
able to encapsulate some functionality which a class can be
decorated with. Giving a basic storage mechanism to that would be
very beneficial in a large amount of uses. Again, I am proposing
private storage only which would be for internal use-only by the
decorating methods.
if someone desperately needs that they could just write a method with
a static variable.
Not really because if you want a container shared across the methods it
wouldn't be very feasible. I'm sure there are some hacks you can do but I just
think it'd be a pretty common use case.
Stefan, you have done a lot of research in this area and I assume have also looked at the most common
use-cases where this functionality is used in other languages. What is your sense?
I've mainly investigated the Squeak implementation which does not
support stateful traits. Therefore, state has been access via required
accessors implemented in the class using the trait. It is a quite
practicable approach, even if it is very strict. But as already
mentioned, there are ideas to allow state and trait-composition local
properties. But here I've not seen any code using it and I am only aware
of the pro and cons discussed in the paper
(http://www.iam.unibe.ch/~scg/Archive/Papers/Berg07eStatefulTraits.pdf).
My be anybody has connections to Scala guys using there Traits construct?
Kind Regards
Stefan
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php