Re: Traits and Properties
| From: | Stefan Marr | Date: | Mon, 13 Dec 2010 16:16:42 +0000 |
| Subject: | Re: Traits and Properties | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51021@lists.php.net to get a copy of this message | ||
Hi Richard:
On 13 Dec 2010, at 14:31, Richard Quadling wrote:
> On 11 December 2010 23:31, Stefan Marr <php@stefan-marr.de> wrote:
>> The current status of the property behavior is not yet documented explicitly
>
> On the assumption that traits WILL include properties (with
> visibility) and aliasing can do all its magic, how would the situation
> be handled where multiple traits define shared properties.
>
> I've not got a use case, but say trait1 and trait2 both define the
> same property.
>
> Assuming name conflicts are handled via aliasing, then the property
> needs to alert the aliasing code that this property is a non
> conflicting property.
Just to emphasize this another time: aliasing is no magic, it is NOT renaming.
(And it is only supported for methods.)
The important implication here is, that aliasing is only useful from the viewpoint of the composing
class.
Form the trait's perspective, aliasing does not have any effect.
Aliasing can be used to make a function accessible that has a naming conflict with another function.
It enables composition of traits, but does not do anything with regard which function names a
trait-function calls. In PHP all function names are late bound, there is no inner binding between
functions in traits.
Hope that clarifies what I perceived as a misconception.
Best regards
Stefan
--
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax: +32 2 629 3525