Re: RFC: Traits for PHP

From: Date: Tue, 19 Feb 2008 20:50:19 +0000
Subject: Re: RFC: Traits for PHP
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-35610@lists.php.net to get a copy of this message
On Tue, 19 Feb 2008 13:23:57 +0100, "Stefan Marr" <php@stefan-marr.de> wrote: > Traits can defined abstract methods to define a required method. This > abstract methods can be implemented in the class or in an other trait. > > There are also notions about stateful traits out there. For instance > Scala does implement them, but state is an additional level of > complexity and I have tried to avoid it in this implementation, since > I have had expected much more complains about the aliasing and exclude > operations and its pretended complexity. > In my opinion stateful traits are the next logical step, but with the > cost for some additional complexity, since you need handle conflicting > properties. (The stateful traits approach is to make it private to a > traits composition, but this might not be obvious to every user.) > > Kind Regards > Stefan (Sorry for the double email; I meant to send this to the list.) So if the Trait is not stateful, what is the advantage over delegation? That was cited in an earlier email as a shortcoming of delegation, but if the Traits implementation doesn't address it either except through a getter/setter, then it's still functionally equivalent to delegation. --Larry Garfield

« previous php.internals (#35610) next »