Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35676 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6976 invoked by uid 1010); 21 Feb 2008 06:51:00 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 6961 invoked from network); 21 Feb 2008 06:51:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 06:51:00 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 76.96.30.24 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 76.96.30.24 qmta02.emeryville.ca.mail.comcast.net Received: from [76.96.30.24] ([76.96.30.24:58747] helo=QMTA02.emeryville.ca.mail.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/F1-20678-35F1DB74 for ; Thu, 21 Feb 2008 01:51:00 -0500 Received: from OMTA09.emeryville.ca.mail.comcast.net ([76.96.30.20]) by QMTA02.emeryville.ca.mail.comcast.net with comcast id s6me1Y0060S2fkCA200S00; Thu, 21 Feb 2008 06:50:36 +0000 Received: from earth.ufp ([24.13.255.226]) by OMTA09.emeryville.ca.mail.comcast.net with comcast id s6qw1Y0034trKQ88V00000; Thu, 21 Feb 2008 06:50:57 +0000 X-Authority-Analysis: v=1.0 c=1 a=67BIL_jfAAAA:8 a=YylfZCUdP8gjvuHDCZUA:9 a=_AegFrWswoy-9d1NtMoA:7 a=URXmCaPpMcdiDEAq-DIFP9z-V2cA:4 a=FHBbIDN7CdwA:10 a=gi0PWCVxevcA:10 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id 186E3D8406 for ; Thu, 21 Feb 2008 00:50:56 -0600 (CST) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.hsd1.il.comcast.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ztJ0W+wuAEbh for ; Thu, 21 Feb 2008 00:50:55 -0600 (CST) Received: from vulcan (unknown [192.168.42.1]) by earth.ufp (Postfix) with ESMTP id EAC19D7ACA for ; Thu, 21 Feb 2008 00:50:45 -0600 (CST) To: internals@lists.php.net Date: Thu, 21 Feb 2008 00:50:44 -0600 User-Agent: KMail/1.9.6 (enterprise 0.20070907.709405) References: <001c01c87264$3c01b4e0$b4051ea0$@de> <200802202354.18400.larry@garfieldtech.com> <698DE66518E7CA45812BD18E807866CE014A8DB0@us-ex1.zend.net> In-Reply-To: <698DE66518E7CA45812BD18E807866CE014A8DB0@us-ex1.zend.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200802210050.44556.larry@garfieldtech.com> Subject: Re: [PHP-DEV] RFC: Traits for PHP From: larry@garfieldtech.com (Larry Garfield) I am unclear on how this: trait ParseThingie { protected function parseThingie($thingie) {...} } trait ProcessThingie { protected function parseThingie($thingie) {...} } class Thingies { use ParseThingie; use ProcessThingie; } allows more opportunity for confusion and clashes than this: trait ParseThingie { public function parseThingie($thingie) {...} } trait ProcessThingie { public function parseThingie($thingie) {...} } class Thingies { use ParseThingie; use ProcessThingie; } (Presumably an un-qualified method would be public for traits just like for classes.) 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. 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 = 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 -- 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