Personally, I don't get deep into how PHP works inside, I'm just a PHP-programmer (the man from userland). For me it will surely be better to use 'insteadof', not 'instead'. And It seems to me more natural to use the following syntax when using grafts:
class Foo { use MyGraft { public graftedClassMethodBar() as bar(); } } $foo = new Foo(); $foo->bar(); 2009/10/15 Tom Boutell <t...@punkave.com>: > I'm very concerned about the practical consequences of introducing > traits without state. > > Lacking support for properties (state) in traits, programmers will > immediately start hacking properties in anyway. > > I see two approaches: > > A. They could do this using static hashes in global variables or a > separate class. The result is a garbage collection failure as these > references to $this will never go away. Designed-in GC failures are > unacceptable post PHP 5.3. > > B. PHP allows you to define properties at runtime. That is, you can write: > > $this->title = 'my title'; > > Without declaring var $title; at the class level. > > But PHP 6 seems to be moving toward more strictness, not less, and > this style encourages the use of undeclared variables with the > resulting potential for missed bugs. > > * * * > > Also, the 'instead' keyword is baffling - it could mean replace A with > B or replace B with A depending on how you place your mental comma - I > much prefer the assignment syntax alternative, or 'insteadof' which is > unambiguous. > > On Wed, Oct 14, 2009 at 4:07 PM, Lukas Kahwe Smith <m...@pooteeweet.org> > wrote: >> >> On 14.10.2009, at 22:03, Stanislav Malyshev wrote: >> >>> Hi! >>> >>>>> So lets warm this up again. >>>>> HEAD is for development .. so lets get this into HEAD so that it will be >>>>> part of the next bigger PHP release for sure! >>>> >>>> Well, the code is sitting here >>>> http://github.com/gron/php-src/tree/PHP_6-traits >>>> and waits to be merged. :) >>> >>> I thought before merging code it would be useful to have some discussion >>> on if the code is actually doing what we want. If it's based on >>> http://wiki.php.net/rfc/horizontalreuse then for example I can see some >>> potential issues for bytecode caching related to renaming and changing >>> visibility. >>> Also, it is not clear that we want grafts there at all, some aspects of >>> them seem to get too hairy, esp. $this issue or statics. >>> >> >> i think Stefan is fully aware of that probably there will be a discussion >> first .. >> but i think we all agree that this feature is very high on the list of what >> people want and therefore i wanted to get this discussion going, so that >> after its concluded traits can be commited to HEAD. >> >> regards, >> Lukas Kahwe Smith >> m...@pooteeweet.org >> >> >> >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >> > > > > -- > Tom Boutell > P'unk Avenue > 215 755 1330 > punkave.com > window.punkave.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Victor -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php