Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35698 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41295 invoked by uid 1010); 21 Feb 2008 18:33:05 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 41280 invoked from network); 21 Feb 2008 18:33:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 18:33:05 -0000 Authentication-Results: pb1.pair.com header.from=mls@pooteeweet.org; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=mls@pooteeweet.org; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pooteeweet.org from 85.10.196.195 cause and error) X-PHP-List-Original-Sender: mls@pooteeweet.org X-Host-Fingerprint: 85.10.196.195 serveforce1.backendmedia.com Linux 2.6 Received: from [85.10.196.195] ([85.10.196.195:51985] helo=serveforce1.backendmedia.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 97/6B-09272-CD3CDB74 for ; Thu, 21 Feb 2008 13:33:00 -0500 Received: from [192.168.0.151] (77-57-23-243.dclient.hispeed.ch [77.57.23.243]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by serveforce1.backendmedia.com (Postfix) with ESMTP id 9066F1224748; Thu, 21 Feb 2008 19:33:28 +0100 (CET) Cc: , , =?ISO-8859-1?Q?Marcus_B=F6rger?= , =?ISO-8859-1?Q?Johannes_Schl=FCter?= , "Sebastian Bergmann" , "Alexandre Bergel" , "Falko Menge" , "Sara Golemon" , Message-ID: To: "Andi Gutmans" In-Reply-To: <698DE66518E7CA45812BD18E807866CE014A8F1E@us-ex1.zend.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v919.2) Date: Thu, 21 Feb 2008 19:32:08 +0100 References: <001c01c87264$3c01b4e0$b4051ea0$@de> <698DE66518E7CA45812BD18E807866CE014A8D9D@us-ex1.zend.net> <698DE66518E7CA45812BD18E807866CE014A8F1E@us-ex1.zend.net> X-Mailer: Apple Mail (2.919.2) X-backendmedia-com-MailScanner-Information: Please contact the ISP for more information X-backendmedia-com-MailScanner: Found to be clean X-backendmedia-com-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=0.134, required 6, AWL 0.03, RDNS_DYNAMIC 0.10) X-backendmedia-com-MailScanner-From: mls@pooteeweet.org X-Spam-Status: No Subject: Re: [PHP-DEV] RFC: Traits for PHP From: mls@pooteeweet.org (Lukas Kahwe Smith) On 21.02.2008, at 19:09, Andi Gutmans wrote: > I don't think so. I think the value here is not copy&paste but to be > able to encapsulate some functionality which a class can be > decorated with. Giving a basic storage mechanism to that would be > very beneficial in a large amount of uses. Again, I am proposing > private storage only which would be for internal use-only by the > decorating methods. if someone desperately needs that they could just write a method with a static variable. class foo { function bar($value = null) { if (!isset($var)) { static $var = 'bar'; } if (func_num_args() > 0) { $var = $value; } return $var; } } $foo = new foo(); var_dump($foo->bar()); var_dump($foo->bar('foo')); var_dump($foo->bar()); ok its a hack .. but you can see how this could work. and you could even expand it to handle an arbitrary number of "properties" in a self contained method. all you need to do is find a name that doesnt clash. again i prefer to keep the feature as simple as possible without crippeling it the point of not being useful. > regards, Lukas