Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35757 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50594 invoked by uid 1010); 23 Feb 2008 19:08:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 50579 invoked from network); 23 Feb 2008 19:08:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2008 19:08:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 82.96.83.42 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 82.96.83.42 serv6.servweb.de Linux 2.4/2.6 Received: from [82.96.83.42] ([82.96.83.42:46647] helo=serv6.servweb.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/6F-30812-31F60C74 for ; Sat, 23 Feb 2008 14:08:04 -0500 Received: from [192.168.0.25] (toolslave.net [85.88.12.247]) by serv6.servweb.de (Postfix) with ESMTP id 25CE05903DA; Sat, 23 Feb 2008 20:09:33 +0100 (CET) Message-ID: <47C06F15.8010907@stefan-marr.de> Date: Sat, 23 Feb 2008 20:08:05 +0100 Reply-To: php@stefan-marr.de User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Andi Gutmans Cc: Lukas Kahwe Smith , internals@lists.php.net References: <001c01c87264$3c01b4e0$b4051ea0$@de> <698DE66518E7CA45812BD18E807866CE014A8D9D@us-ex1.zend.net> <698DE66518E7CA45812BD18E807866CE014A8F1E@us-ex1.zend.net> <698DE66518E7CA45812BD18E807866CE014A8F72@us-ex1.zend.net> In-Reply-To: <698DE66518E7CA45812BD18E807866CE014A8F72@us-ex1.zend.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Redirected: By TestProxy Subject: Re: [PHP-DEV] RFC: Traits for PHP From: php@stefan-marr.de (Stefan Marr) Hi, Andi Gutmans schrieb: >>> 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. > > Not really because if you want a container shared across the methods it wouldn't be very feasible. I'm sure there are some hacks you can do but I just think it'd be a pretty common use case. > > Stefan, you have done a lot of research in this area and I assume have also looked at the most common > use-cases where this functionality is used in other languages. What is your sense? I've mainly investigated the Squeak implementation which does not support stateful traits. Therefore, state has been access via required accessors implemented in the class using the trait. It is a quite practicable approach, even if it is very strict. But as already mentioned, there are ideas to allow state and trait-composition local properties. But here I've not seen any code using it and I am only aware of the pro and cons discussed in the paper (http://www.iam.unibe.ch/~scg/Archive/Papers/Berg07eStatefulTraits.pdf). My be anybody has connections to Scala guys using there Traits construct? Kind Regards Stefan