On Monday, December 13, 2010 10:02:13 am Stefan Marr wrote:

> However, since traits do not provide any safety provisioning for state,
> i.e., there is no collision handling for properties, the question is, how
> do we either promote to use explicit accessors or how do we deal with the
> inevitable and certainly justified use of properties in one or the other
> way.
> 
> Best regards
> Stefan

Thinking about it, I'm not sure that accessors are really a solid solution 
either.

Behavior has to have something to behave on.  So whether you have 

$this->foo 

or

$foo = $this->getFoo();
// Do stuff with $foo
$this->setFoo($foo);

You still have a dependency that the composing class have either a property 
named $foo or a pair of (frankly pointless) get/set methods.

So either a composing class needs to know about the internal implementation 
details of a trait (what it calls variables inside of a method) so that it can 
provide what the trait needs, or a trait needs to be able to carry around its 
own implementation details.

So it seems to me like we can't not let traits carry properties, which means 
we need to resolve them some how.

--Larry Garfield

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to