Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51450 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24013 invoked from network); 15 Feb 2011 15:02:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2011 15:02:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=jbondc@openmv.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=jbondc@openmv.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain openmv.com from 64.15.152.204 cause and error) X-PHP-List-Original-Sender: jbondc@openmv.com X-Host-Fingerprint: 64.15.152.204 mail.ca.gdesolutions.com Received: from [64.15.152.204] ([64.15.152.204:59221] helo=mail.ca.gdesolutions.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 54/A0-20044-B959A5D4 for ; Tue, 15 Feb 2011 10:02:52 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 867255D52; Tue, 15 Feb 2011 10:02:49 -0500 (EST) X-Virus-Scanned: amavisd-new at gdesolutions.com Received: from mail.ca.gdesolutions.com ([127.0.0.1]) by localhost (mail.ca.gdesolutions.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OXrqPAhsBOzT; Tue, 15 Feb 2011 10:02:49 -0500 (EST) Received: from djbondc (modemcable083.208-56-74.mc.videotron.ca [74.56.208.83]) by mail.ca.gdesolutions.com (Postfix) with ESMTP id 3F4FA5D51; Tue, 15 Feb 2011 10:02:49 -0500 (EST) To: "'Ben Schmidt'" , References: <4D206CA4.6060004@yahoo.com.au> <005f01cbadc9$1172d080$34587180$@com> <4D284B8B.5040408@yahoo.com.au> <4D537DE1.2010309@yahoo.com.au> <36AB1B1C-1C92-475D-84C7-D0B0DB8FE462@roshambo.org> <4D541F8A.4050502@yahoo.com.au> In-Reply-To: <4D541F8A.4050502@yahoo.com.au> Date: Tue, 15 Feb 2011 10:02:48 -0500 Message-ID: <007201cbcd21$696da7c0$3c48f740$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcvJR58kgzySrR3qR+OJEvdS1v4quwD1haHg Content-Language: en-ca Subject: RE: [PHP-DEV] Extensions to traits From: jbondc@openmv.com ("Jonathan Bond-Caron") On Thu Feb 10 12:25 PM, Ben Schmidt wrote: > > http://wiki.php.net/rfc/traitsmodifications > Some thoughts: a) Class method conflict with trait Class implementation always wins I feel is the right way to think about traits. But 'abstract' already has special meaning, so maybe a keyword like 'final' could also do something special. b) Support for 'non-breakable traits' - Add trait-local scope Really like the idea and how this could make traits less fragile. e.g. trait Foo { trait $bar; public $bar; } Could change the syntax to: trait Foo { var $bar = 'visibleByTrait'; // variable private to the trait -- zend_mangle_property_name('#Foo {NULL} bar') public $bar = 'visibleByClass'; // variable public to the class it gets composed in } class Test { use Foo; } $t = new Test; echo $t->bar; // 'visibleByClass' Seems like it could allow traits to have their own independent state (private properties), internally ~ zend_mangle_property_name('#' trait name {NULL} prop name). Small note: is there a plan to drop the T_VAR token? Any objections, concerns, more thoughts on the concept? c) Extend 'use' syntax Didn't quite understand, will read again. Have you thought about how this could affect the reflection api and documentation?