RE: [PHP-DEV] How to build a real Trait thing without exclusion and renaming

From: Date: Thu, 28 Feb 2008 04:14:17 +0000
Subject: RE: [PHP-DEV] How to build a real Trait thing without exclusion and renaming
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-35840@lists.php.net to get a copy of this message
> -----Original Message----- > From: Stanislav Malyshev [mailto:stas@zend.com] > Sent: Wednesday, February 27, 2008 7:07 PM > To: Andi Gutmans > Cc: php@stefan-marr.de; internals Mailing List > Subject: Re: [PHP-DEV] How to build a real Trait thing without > exclusion and renaming > > Hi! > > > trait MyDebug { > > local $counter = 1; > > IIRC we don't have keyword "local". Why not "private" or > "static"? I wouldn't get too caught up on the naming at this point but rather the functionality. > > class MyClock { > > use MyDebug *; > > use MyTicks { > > timeInTicks = inTicks; > > This looks like code which does assignment. How I am supposed to > understand from it that a new method for MyClock API is born? > > In any case, why you need timeInTicks at all? If you need it public, > why > not write an accessor? It'd be better OO anyway, since MyClock's > clients > can't know about MyTicks's details or even its existence. This is just an example of being able to alias a method from a trait. Assuming two traits would use the same name this would give you the ability to include it under a different name. The point is we can alias but we can not remove. Andi

« previous php.internals (#35840) next »