Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:48664 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30983 invoked from network); 5 Jun 2010 20:47:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2010 20:47:48 -0000 Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:54635] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/95-25133-2F7BA0C4 for ; Sat, 05 Jun 2010 16:47:47 -0400 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.14]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1OL0HK-0006nX-N8 for internals@lists.php.net; Sat, 05 Jun 2010 22:47:41 +0200 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Sat, 5 Jun 2010 22:47:34 +0200 Message-ID: <0A769B4E-C9DA-44F2-B3DA-5998D1D7E6E0@stefan-marr.de> To: PHP internals Mime-Version: 1.0 (Apple Message framework v1078) X-Mailer: Apple Mail (2.1078) Subject: Traits and static variables From: php@stefan-marr.de (Stefan Marr) Hi: Was just thinking about some details of the traits implementation. =46rom my perspective, static variables in methods should work like the = method would have been actually implemented in the class using the = traits. Thus, static variables should be independent for the different = traits usages. Any thoughts on that? Below, I attached the relevant test case. Best regards Stefan --TEST-- Statics work like expected for language-based copy'n'paste. No link = between methods from the same trait. --FILE-- inc(); $o->inc(); $p =3D new C2(); $p->inc(); $p->inc(); ?> --EXPECTF--=09 1 2 1 2