Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51019 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14016 invoked from network); 13 Dec 2010 13:32:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Dec 2010 13:32:44 -0000 Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:32964] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/60-10983-770260D4 for ; Mon, 13 Dec 2010 08:32:41 -0500 Received: by qwj8 with SMTP id 8so6355020qwj.29 for ; Mon, 13 Dec 2010 05:32:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:reply-to :in-reply-to:references:from:date:message-id:subject:to:cc :content-type; bh=7kCjb5SDGOQ3zWdGK8VJhLFZDFXvAl1y/v8VM5ZLEEo=; b=CDgbHrbG1D37P4gAJBwcFVh1kpqS/o6EQGNMgrNo396O2/U5QFKGiyO+a/KFasnKeU cB/SI3oTNhogmG+WOMFbesD5DCSQibqwYmoEvcwyFNHZYL/dKuA9Xf4XXQxWY0eXvFTp cJZ27zSVvG6/+QfvTEwV9H8QvEnBT5ayLQWmo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; b=QGiG7C48YBTrC7WOWWM1eGpqsX9xLFFsQ8WzpANp2GjHdy32PAiF6szw+ikp/Jkd3I D9aCG5NKLQQEuD+6p3dgrwhHANsIcfDkVSyO4PEYvQdwuiTmvaCVmZDA8VJBf3xc9zzr fdaLQMhZtagn6QB8ac2fw1VCbfDCY/0pcjS6Y= Received: by 10.229.84.81 with SMTP id i17mr3778071qcl.215.1292247123682; Mon, 13 Dec 2010 05:32:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.229.100.130 with HTTP; Mon, 13 Dec 2010 05:31:43 -0800 (PST) Reply-To: RQuadling@googlemail.com In-Reply-To: References: <89C52156-CF92-4DDB-8BA4-4ABF6883512C@stefan-marr.de> Date: Mon, 13 Dec 2010 13:31:43 +0000 Message-ID: To: Stefan Marr Cc: Pierre Joye , "internals@lists.php.net Development" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Traits and Properties From: rquadling@gmail.com (Richard Quadling) On 11 December 2010 23:31, Stefan Marr wrote: > The current status of the property behavior is not yet documented explicitly On the assumption that traits WILL include properties (with visibility) and aliasing can do all its magic, how would the situation be handled where multiple traits define shared properties. I've not got a use case, but say trait1 and trait2 both define the same property. Assuming name conflicts are handled via aliasing, then the property needs to alert the aliasing code that this property is a non conflicting property. All traits wanting to access the shared property would have to reveal their intentions. I can think of 2 ways to handle this (but I'm no genius here, so take them apart at your pleasure). 1 - The trait's code marks shared properties with a keyword (shared, common, virtual, something). During incorporation of the trait into the main class, any marked properties are checked for visibility only. 2 - The trait's code uses a &$property. The fact that this is a reference would require the creation of the property (if it doesn't already exist) whilst the trait is being compiled into the main class. I'd guess this would be the least difficult to implement, but I know squat about this. I'm guessing the order of handling the traits would be significant here. Trait1 uses $property, Trait2 uses $property - conflict. Must be resolved by aliasing or an error. Trait1 uses &$property, Trait2 uses &$property - all ok. Trait1 wants access a non existing property, so one is created. Trait2 is sharing the now pre-existing property. Trait1 uses &$property, Trait2 uses $property - conflict. Trait1 wants access a non existing property, so one is created. Trait2's $property must be aliased to an error. Trait1 uses $property, Trait2 uses &$property - all ok. Trait1's $property is added as expected. Trait2 is sharing the now pre-existing property. Richard. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY