Because then you get into similar problems as with multiple inheritance
when you have property clashes and other issues.
The reason why private is beneficial and different because it will allow
you to develop self contained functionality which can be attached to
random classes. This can be quite useful for Timers, Counters,
Containers, etc...

Andi

> -----Original Message-----
> From: Larry Garfield [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 20, 2008 9:54 PM
> To: internals@lists.php.net
> Subject: Re: [PHP-DEV] RFC: Traits for PHP
> 
> On Wednesday 20 February 2008, Andi Gutmans wrote:
> 
> > a)
> > I think Traits should be able to act as a self-contained behavior
> which can
> > always be expected to work. For example if I want a Counter behavior
> I
> > would like that not to depend on the properties in the containing
> class.
> > While I don't think we should enable public nor protected properties
> in
> > Traits I think allowing for private properties in Traits would come
> in very
> > handy. It also is no problem when it comes to mangling as we can use
> the
> > Trait name.
> >
> > class Trait {
> >     private $counter = 0;
> >     function getNextSerialNumber() {
> >             return $this->counter++;
> >     }
> > }
> >
> > I strongly recommend not to support protected/public and not to even
> get
> > into the discussion of dealing with conflicts of such properties.
But
> I
> > think private is very useful.
> 
> Hi Andi.  Why no ppp on Traits?  It seems useful to be able to pull in
> a
> utility function or functions that can be leveraged from other
methods,
> like
> domain-specific parsers, without exposing them to the outside world.
> Is it
> an engine-level implementation issue, or a conceptual complexity
issue?
> I
> don't really see a complexity issue on the developer level, at least
> for me.
> 
> --
> Larry Garfield                        AIM: LOLG42
> [EMAIL PROTECTED]             ICQ: 6817012
> 
> "If nature has made any one thing less susceptible than all others of
> exclusive property, it is the action of the thinking power called an
> idea,
> which an individual may exclusively possess as long as he keeps it to
> himself; but the moment it is divulged, it forces itself into the
> possession
> of every one, and the receiver cannot dispossess himself of it."  --
> Thomas
> Jefferson
> 
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to