Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51010 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3165 invoked from network); 11 Dec 2010 22:13:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Dec 2010 22:13:18 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.45 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.214.45 mail-bw0-f45.google.com Received: from [209.85.214.45] ([209.85.214.45:39686] helo=mail-bw0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/01-25815-C77F30D4 for ; Sat, 11 Dec 2010 17:13:17 -0500 Received: by bwz16 with SMTP id 16so5684060bwz.32 for ; Sat, 11 Dec 2010 14:13:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=A8kMAnRpU9Ruu65actV9CR+Ad6duI/HcNCqvhCmQx1I=; b=utu00aobQeEHtv5O+S2dacL4CuSn/8peZpa9VB1Hd9L+F+WKBBDTB9RYS8v3H0Z6V3 UJwiykB0Pef/1uojsoo6yZ7YPNPeivv4GH6XpoEbiPGwWp5aCJP6GpgW/YwicRGUkmnP /t55/TfPHeFg823gBktpQvAf7gi3kzJBLGxNg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=jgOcaiqzox/PeAtph70noGk3drba3inZ83LMSDT0OWHElenqCFLIJYlXvHzu7N+q9d reNFPoiQbjc4G5iwkzxCplqxTGmWzZe0mvtscz4rnj47bHbFVeLMGg13PdvXEfRQcrd2 gDB+BaXtiZIk2a2uJ+FoEJmHv7KUHxDb7px0w= MIME-Version: 1.0 Received: by 10.204.81.148 with SMTP id x20mr2150953bkk.172.1292105592491; Sat, 11 Dec 2010 14:13:12 -0800 (PST) Received: by 10.204.52.129 with HTTP; Sat, 11 Dec 2010 14:13:12 -0800 (PST) In-Reply-To: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> References: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> Date: Sat, 11 Dec 2010 23:13:12 +0100 Message-ID: To: Stefan Marr Cc: "internals@lists.php.net Development" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Traits and Properties From: pierre.php@gmail.com (Pierre Joye) hi, 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. Thanks! On Sat, Dec 11, 2010 at 5:47 PM, Stefan Marr wrote: > Hi: > > Traits do not provide any special provisioning for handling properties, e= specially, there is no language solution for handling colliding property na= mes. > 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 referenc= e to the property in the class. > > However, at the moment it is possible to define properties in a trait: > > trait Foo { > =A0private $a; > =A0public =A0$foo; > } > > For the moment, that information is completely ignored, thus: > > class Bar { > =A0use Foo; > } > property_exists('Bar', 'a') =3D=3D=3D false > > > Well, and that is a rather inconsistent status-quo. > > I would like to have that fixed in one or another way. > > One possibility would be to forbid property definition in a trait altoget= her. > That reduces a bit the possibility to have wrong expectations about prope= rties, however, the dynamic property creation is still possible. > > Another way would be to merge the properties in the composing class. > The question here would be how to treat visibility modifiers: how to merg= e 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 whe= never properties are silently merged. > > > Comments very welcome. > > Thanks > Stefan > > -- > 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: =A0 +32 2 629 3525 > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org