Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54471 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 59861 invoked from network); 8 Aug 2011 14:53:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2011 14:53:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=ava3ar@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ava3ar@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.170 as permitted sender) X-PHP-List-Original-Sender: ava3ar@gmail.com X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:65314] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 30/31-53378-B48FF3E4 for ; Mon, 08 Aug 2011 10:53:00 -0400 Received: by vxh24 with SMTP id 24so3002871vxh.29 for ; Mon, 08 Aug 2011 07:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=PqJKMAPnMYgZEh2863quM5WfpQ2+T4JaxNW1yqXGMRw=; b=Bwm9ysRsck4AyXzLbK5QZWdyRIvbWo6ZrJBeab7xQCc2reJI3bqTBZcRNlzNeGRdQu mM7bfQ7UpLPSBilahMQrCZS4gr//4WXZhIkxvPSSfLCebm8lTExOYHUE4yTnmNszD5U0 QHgOlSWSR0FcZVsBs6NIIZ00Ps4c5tfRvTM8s= Received: by 10.220.72.138 with SMTP id m10mr1207767vcj.41.1312815177388; Mon, 08 Aug 2011 07:52:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.167.2 with HTTP; Mon, 8 Aug 2011 07:52:37 -0700 (PDT) In-Reply-To: <4E2DF347.7090800@lerdorf.com> References: <1311614509.2886.16.camel@guybrush> <4E2DF347.7090800@lerdorf.com> Date: Mon, 8 Aug 2011 15:52:37 +0100 Message-ID: To: Rasmus Lerdorf Cc: php@stefan-marr.de, =?ISO-8859-1?Q?Johannes_Schl=FCter?= , PHP internals list , gron@php.net Content-Type: multipart/alternative; boundary=00163631081b4dd13c04a9ff9abb Subject: Re: [PHP-DEV] Reflection, Traits, Aliasing From: ava3ar@gmail.com (Keloran) --00163631081b4dd13c04a9ff9abb Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable There seems to be a bug in traits that if you use any of the GLOBAL vars it segfaults e.g. getStuff("tester"); } } that causes a segfault change the trait to wrote= : > On 07/25/2011 02:05 PM, Stefan Marr wrote: > > Hi Johannes: > > > > 2011/7/25 Johannes Schl=FCter : > > > >> Now I use reflection on this: > >> > >> $rc =3D new ReflectionClass('C'); > >> print_r($rc->getTraitAliases()); > >> > >> Array > >> ( > >> [tc] =3D> T1::t1 > >> ) > > > > Great, that is nice. > > > > > >> So far so nice but I'm missing the information where C::t1() is coming > >> from. In the reflection code I'm currently iterating over > >> ce->trait_aliases and can't find where I can get the information from. > >> Actually I'd be even interested in getting all important methods and > >> their origin. Stefan, do you know where I can find the information or > >> would we have to store it additionally? > > The functions do not store that information, so there are basically > > only two approaches, I see: > > > > Either, factoring out the code which is doing the flattening, conflict > > resolution, and class composition into something which could be easily > > shared by both the reflection and the engine, and then re-doing it on > > demand in the reflection, > > or we extend zend_function by an origin pointer. > > > > Not sure what the better tradeoff is general memory overhead vs. > > cache-able pay-as-you-go overhead. > > Is it really worth any overhead here at all? This information is still > there, you just have to work at it a bit. You know which traits are > being used for class C. T1 and T2. You can look at T1 and T2 and see > they both provide t1 methods, but you see from the list of aliases on C > that T1::t1 was aliased to tc, therefore C::t1 must come from T2 since > the trait is used in C and it isn't aliased. I don't think we need > anything else here. > > -Rasmus > > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --00163631081b4dd13c04a9ff9abb--