Re: RFC: Traits for PHP
| From: | David Zülke | Date: | Thu, 21 Feb 2008 23:26:26 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35711@lists.php.net to get a copy of this message | ||
Am 22.02.2008 um 00:16 schrieb Stefan Marr:
Sounds a bit like what had been proposed in this paper: http://www.iam.unibe.ch/~scg/Archive/Papers/Duca07b-FreezableTrait.pdf The first point, yes exclusion and aliasing are only meant to handle conflicts, and should be used only in this context. Yeah you can break the trait with it, but you did it explicitly, think this should be made clear a bit more in the discussion about "breaking interfaces". Nobody would request unset to be removed from the function set even though you can do this: $a = new A(); unset($a); $a->foo(); //damn... It is "almost" like excluding a method from a trait and be worried about the trait breaks. Isn't it? :)I agree. It's called "asking for it". Since traits can only be added in dynamically, a programmer always knows what he is doing when excluding or aliasing a method in a trait. PHP needs to stop worrying about the "confusing newbies" thing when discussing advanced features. We're not talking about a basic bread and butter language construct here. Other parts of PHP aren't beginner friendly either, and not all parts ever could, let alone should. David