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

From: Date: Fri, 29 Feb 2008 02:52:16 +0000
Subject: RE: [PHP-DEV] How to build a real Trait thing without exclusion and renaming
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-35859@lists.php.net to get a copy of this message
That's fine. I'm not attached to any name just the concept :) > -----Original Message----- > From: Marcus Boerger [mailto:helly@php.net] > Sent: Thursday, February 28, 2008 6:42 AM > To: Andi Gutmans > Cc: Stas Malyshev; php@stefan-marr.de; internals Mailing List > Subject: Re: [PHP-DEV] How to build a real Trait thing without > exclusion and renaming > > Hello Andi, > > I agree with Stas about 'local' and actually his reasoning is why I > simply suggested 'private'. That also has the advantage that people > already > know what it does. > > marcus > > Thursday, February 28, 2008, 5:14:17 AM, you wrote: > > >> -----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 > > > > > Best regards, > Marcus

« previous php.internals (#35859) next »