Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51020 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 29484 invoked from network); 13 Dec 2010 16:02:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2010 16:02:23 -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 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:55709] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/70-23631-C83460D4 for ; Mon, 13 Dec 2010 11:02:21 -0500 Received: from [134.184.43.20] by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PSApz-0006h8-EQ; Mon, 13 Dec 2010 17:01:22 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Mon, 13 Dec 2010 17:02:13 +0100 Cc: "internals@lists.php.net Development" Content-Transfer-Encoding: quoted-printable Message-ID: References: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> To: RQuadling@googlemail.com X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] Traits and Properties From: php@stefan-marr.de (Stefan Marr) Hi Richard: On 13 Dec 2010, at 14:13, Richard Quadling wrote: > =46rom the rfc [1], "A Trait is similar to a class, but only intended = to > group functionality". >=20 > I'm guessing that says it all. A trait has no properties. It is really a practical concern of language consistency for the moment. I am not talking about any fancy new language feature to handle state. At the moment, I am just concerned with examples like the following: trait Foo { function bar() { $this->baz =3D 'abcd'; } } If that example becomes more complex, I would consider it to be good = software engineering practice to document the usage of $this->baz and = its semantic. For classes this is usually done by explicitly naming the property in = the class body. At the moment, there is nothing which hinders you in doing that for a = trait. However, since traits do not provide any safety provisioning for state, = i.e., there is no collision handling for properties, the question is, = how do we either promote to use explicit accessors or how do we deal = with the inevitable and certainly justified use of properties in one or = the other way. Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525