Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35678 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13515 invoked by uid 1010); 21 Feb 2008 07:19:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13499 invoked from network); 21 Feb 2008 07:19:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 07:19:23 -0000 Authentication-Results: pb1.pair.com header.from=andi@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=andi@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: andi@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Windows 2000 SP4, XP SP1 Received: from [212.25.124.162] ([212.25.124.162:9986] helo=mx1.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 69/F2-20678-AF52DB74 for ; Thu, 21 Feb 2008 02:19:22 -0500 Received: from us-ex1.zend.com ([192.168.16.5]) by mx1.zend.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 21 Feb 2008 09:19:27 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Wed, 20 Feb 2008 23:19:23 -0800 Message-ID: <698DE66518E7CA45812BD18E807866CE014A8DBE@us-ex1.zend.net> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP-DEV] RFC: Traits for PHP Thread-Index: Ach0VkQcmqjgI3gES2eFiWHatQ5RzwAA7gCQ References: <001c01c87264$3c01b4e0$b4051ea0$@de> <200802202354.18400.larry@garfieldtech.com> <698DE66518E7CA45812BD18E807866CE014A8DB0@us-ex1.zend.net> <200802210050.44556.larry@garfieldtech.com> To: "Larry Garfield" , X-OriginalArrivalTime: 21 Feb 2008 07:19:27.0218 (UTC) FILETIME=[179E2D20:01C8745A] Subject: RE: [PHP-DEV] RFC: Traits for PHP From: andi@zend.com ("Andi Gutmans") My email talked about properties not methods. Please re-read it :) Andi > -----Original Message----- > From: Larry Garfield [mailto:larry@garfieldtech.com] > Sent: Wednesday, February 20, 2008 10:51 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] RFC: Traits for PHP >=20 > I am unclear on how this: >=20 > trait ParseThingie { > protected function parseThingie($thingie) {...} > } > trait ProcessThingie { > protected function parseThingie($thingie) {...} > } > class Thingies { > use ParseThingie; > use ProcessThingie; > } >=20 > allows more opportunity for confusion and clashes than this: >=20 > trait ParseThingie { > public function parseThingie($thingie) {...} > } > trait ProcessThingie { > public function parseThingie($thingie) {...} > } > class Thingies { > use ParseThingie; > use ProcessThingie; > } >=20 > (Presumably an un-qualified method would be public for traits just like > for > classes.) >=20 > OK the above example is a bit of a strawman, but I don't know a non- > strawman > example here. :-) That's the clarification I'm asking for. >=20 > On Thursday 21 February 2008, Andi Gutmans wrote: > > 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:larry@garfieldtech.com] > > > 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 =3D 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 > > > larry@garfieldtech.com 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 >=20 >=20 > -- > Larry Garfield AIM: LOLG42 > larry@garfieldtech.com ICQ: 6817012 >=20 > "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 >=20 > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php