Re: RFC: Traits for PHP
| From: | Christian Schneider | Date: | Fri, 22 Feb 2008 17:27:24 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35738@lists.php.net to get a copy of this message | ||
Richard Quadling schrieb:
On 21/02/2008, Richard Lynch <ceo@l-i-e.com> wrote:We even would not need a new keyword, we could use "include" for this. The user would not really care if this is compile time or run time as long as the simple (and most useful) case Just Works IMHO.In fact, new users are often confused because the CAN'T do an include in the middle of a class -- A rule which, to some, seems arbitrary and illogical.And once they understand (if they do) why they cannot use "include", they want to know how to do it anyway. Traits answer this quite nicely. All be it in a way which the idea of include would solve if it was done at parse/compile time. So, maybe something as simple as class_include 'file.inc';
But having said that traits LOOK nice. They look clever. Is it over complicated? If you don't know OOP, then maybe. But hell if everything was easy we would have monkeys doing it all for us.I'm trying to suppress my reservations about new language constructs and was quite succesful: I started to like Traits. But the discussion about the semantics are close to making me reconsider: If you (the core developers and language designers) cannot agree on the semantics (stateless vs. stateful traits, etc.) I wonder how the user is going to feel about it.
Traits look good. Many userland developers would use them. Many moreThe use case examples I've seen so far haven't been all that convincing to me but that's probably because of a different coding style. - Chris