Re: Extensions to traits
| From: | André Rømcke | Date: | Sun, 13 Feb 2011 10:15:59 +0000 |
| Subject: | Re: Extensions to traits | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51444@lists.php.net to get a copy of this message | ||
On Thu, Feb 10, 2011 at 6:25 PM, Ben Schmidt
<mail_ben_schmidt@yahoo.com.au>wrote:
> On 11/02/11 3:37 AM, Philip Olson wrote:
>
>> You now have rights to the wiki rfc namespace.
>>
>
> Thanks a lot, Philip.
>
> I have now made an RFC based on the most recent discussions:
>
> http://wiki.php.net/rfc/traitsmodifications
>
> I think this is a more solid proposal than my original one, and I hope
> we can continue to discuss it and agree to the extent that it's worth
> starting an implementation.
>
> Please read it and comment whenever you can find some time, guys!
>
As for your first example:
trait T {
public function foo() {
echo <http://www.php.net/echo> "T";
}}class C {
use T;
public function foo() {
echo <http://www.php.net/echo> "C";
}}
I think it would sometimes be desirable to allow this, for instance when a
trait has been updated in a framework to adapt to what has become common
practice in classes that uses it in the wild.
( I assume you already get error if function signature is different like in
inheritance? )
So to allow both cases, what about letting people use the final keyword on
functions to signal functions that can not be re declared without alias. Or
better, add a new keyword since final should mean final.
My 2 Euro cents,
André