Re: How to build a real Trait thing without exclusion and renaming
| From: | Stefan Marr | Date: | Thu, 28 Feb 2008 07:30:48 +0000 |
| Subject: | Re: How to build a real Trait thing without exclusion and renaming | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35842@lists.php.net to get a copy of this message | ||
Hi,
Joshua Thompson schrieb:
Andi Gutmans wrote:The following code shows a few things: - local properties which can be used in self-contained functionality. The storage is guaranteed to stay internal and will not clash with the aggregating class. Yes, it is a nice to have.
- methods are by default hidden to the aggregating class and bound to the trait (as Marcus pointed out the method name would be mangled with the trait's name) Hm, ok. It is the pessimistic counterpart to my proposal. In general, I'm much more optimistic and would prefer to teach developers to use proper naming to avoid conflicts. But if there is no other way to go, it is ok.
I was working on a detailed RFC of something along these lines. I didn't include the local keyword, instead I went the route of stateful traits and forced the definition of which scope in the class. I also tried to keep the number of keywords to 1 (trait).
I will keep working on it, and hopefully post it tomorrow for review.
Looking forward to read it :)
Kind Regards
Stefan