Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51011 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11089 invoked from network); 11 Dec 2010 23:32:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2010 23:32:09 -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:42118] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A5/D1-25815-5F9040D4 for ; Sat, 11 Dec 2010 18:32:06 -0500 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.26]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1PRYuH-000422-3x; Sun, 12 Dec 2010 00:31:16 +0100 Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii In-Reply-To: Date: Sun, 12 Dec 2010 00:31:52 +0100 Cc: "internals@lists.php.net Development" Content-Transfer-Encoding: quoted-printable Message-ID: References: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> To: Pierre Joye X-Mailer: Apple Mail (2.1082) Subject: Re: [PHP-DEV] Traits and Properties From: php@stefan-marr.de (Stefan Marr) Hi Pierre: On 11 Dec 2010, at 23:13, Pierre Joye wrote: > hi, >=20 > Would it be possible to somehow document what you are discussing here? > It is not too easy to keep track of all discussions about traits > (along other things). Maybe in draft RFC or a simple page in the wiki. > Doing so will help to have a quick view about the open questions or > recent changes/propositions. Yes, I try to keep track of all this in the RFC: http://wiki.php.net/rfc/horizontalreuse?do=3Drevisions The current status of the property behavior is not yet documented = explicitly, it is only implied since it is not handled at all... And, it is the only open question that 'needs' to be solved since it is = an inconsistency. For instance the 'require Interface' is more like an additional feature. Best regards Stefan >=20 > Thanks! >=20 > On Sat, Dec 11, 2010 at 5:47 PM, Stefan Marr = wrote: >> Hi: >>=20 >> Traits do not provide any special provisioning for handling = properties, especially, there is no language solution for handling = colliding property names. >> The current solution/idiom for handling state safely in a trait is to = use either abstract set/get methods or an abstract get that returns a = reference to the property in the class. >>=20 >> However, at the moment it is possible to define properties in a = trait: >>=20 >> trait Foo { >> private $a; >> public $foo; >> } >>=20 >> For the moment, that information is completely ignored, thus: >>=20 >> class Bar { >> use Foo; >> } >> property_exists('Bar', 'a') =3D=3D=3D false >>=20 >>=20 >> Well, and that is a rather inconsistent status-quo. >>=20 >> I would like to have that fixed in one or another way. >>=20 >> One possibility would be to forbid property definition in a trait = altogether. >> That reduces a bit the possibility to have wrong expectations about = properties, however, the dynamic property creation is still possible. >>=20 >> Another way would be to merge the properties in the composing class. >> The question here would be how to treat visibility modifiers: how to = merge public and private, should it result in public, or private? >> And, to discorage users to go this way, should there be a STRICT = notice? Options here are a notice whenever a property is defined in a = trait, or whenever properties are silently merged. >>=20 >>=20 >> Comments very welcome. >>=20 >> Thanks >> 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 >>=20 >>=20 >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >>=20 >>=20 >=20 >=20 >=20 > --=20 > Pierre >=20 > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org --=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