Re: RFC: Traits for PHP

From: Date: Fri, 22 Feb 2008 17:22:52 +0000
Subject: Re: RFC: Traits for PHP
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-35737@lists.php.net to get a copy of this message
Hi!
Fun that you mentionned that structure greg because I was thinking of something along those lines. Something very similar actually but the aliasing could look like this: trait One {
    function name() { return __TRAIT__; }
    function removeMe() {}
} trait Two {
    function name() { return __TRAIT__; }
} class Reel traits One, Two {
    override One::name with Two::name;
    remove Two::removeMe;
} $object = new Reel(); echo $object->name(); // Echos "Two" of course.
Two doesn't have removeMe. If you meant One::removeMe then why One is needed at all? You didn't use any method of it. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#35737) next »