Re: RFC: Traits for PHP
| From: | Richard Lynch | Date: | Mon, 18 Feb 2008 22:37:12 +0000 |
| Subject: | Re: RFC: Traits for PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-35565@lists.php.net to get a copy of this message | ||
On Mon, February 18, 2008 1:27 pm, php@stefan-marr.de wrote:
> <?php
> trait ezcReflectionReturnInfo {
> function getReturnType() { /*1*/ }
> function getReturnDescription() { /*2*/ }
> }
>
> class ezcReflectionMethod extends ReflectionMethod {
> use ezcReflectionReturnInfo;
So it's just like an include for a re-used body of 'class' code.
Hmmmm.
Why not just allow 'include' here instead?
:-)
Forgive me if I'm missing something subtle/complex here, but I wonder
if a Trait is really the "right answer"...
Yes, the ability to add/exclude specific functions from two Traits is
"gone" with a simple 'include'... But so is the complexity of yet
another language construct...
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?