Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56280 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1966 invoked from network); 11 Nov 2011 16:41:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Nov 2011 16:41:58 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:51429] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A1/F2-17932-2505DBE4 for ; Fri, 11 Nov 2011 11:41:56 -0500 Received: from [192.168.2.230] (ppp-93-104-52-79.dynamic.mnet-online.de [93.104.52.79]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 73247782EC; Fri, 11 Nov 2011 17:41:43 +0100 (CET) To: Rasmus Schultz Cc: internals@lists.php.net In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Fri, 11 Nov 2011 17:41:42 +0100 Message-ID: <1321029702.3614.6.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] some notes about traits From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) I keep most of this to other but two comments: On Fri, 2011-11-11 at 11:00 -0500, Rasmus Schultz wrote: > Lastly, when you reflect on a trait, it comes back as an instance of > ReflectionClass. As pointed out, traits are probably more similar to > interfaces than they are to classes, and they definitely don't have > properties, as are exposed by the ReflectionClass type. 1) Interface use ReflectionClass, too. 2) Traits may (for whatever reason) have properties $ php -r 'trait T { public $p; } ReflectionClass::export("T");' Trait [ trait T ] { [...] - Properties [1] { Property [ public $p ] } In general: Reflection is always quite close to the internal structures not far abstracted away. Always closer to the C implementation than PHP land. Changing that would affect multiple areas in there. This might have benefits here and there but now it resembles the actual workings better which has also some benefits ... > I would also point out that the examples in the documentation (which > it > seems were just copied from the RFC?) do not demonstrate any real > purpose > of this feature. Is this the most anybody has attempted to do with > this > feature? Trying to come up with a real example, I didn't get very far > before running into these stumbling blocks. I once stumbled over http://knplabs.com/blog/csi/php-materialized-path-tree johannes