Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51244 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48561 invoked from network); 8 Jan 2011 12:39:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2011 12:39:22 -0000 Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.139.91.98 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: mail_ben_schmidt@yahoo.com.au X-Host-Fingerprint: 98.139.91.98 nm28.bullet.mail.sp2.yahoo.com Received: from [98.139.91.98] ([98.139.91.98:37690] helo=nm28.bullet.mail.sp2.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/12-36205-8FA582D4 for ; Sat, 08 Jan 2011 07:39:22 -0500 Received: from [98.139.91.65] by nm28.bullet.mail.sp2.yahoo.com with NNFMP; 08 Jan 2011 12:39:18 -0000 Received: from [98.139.91.8] by tm5.bullet.mail.sp2.yahoo.com with NNFMP; 08 Jan 2011 12:39:18 -0000 Received: from [127.0.0.1] by omp1008.mail.sp2.yahoo.com with NNFMP; 08 Jan 2011 12:39:18 -0000 X-Yahoo-Newman-Id: 363828.24245.bm@omp1008.mail.sp2.yahoo.com Received: (qmail 40378 invoked from network); 8 Jan 2011 12:39:17 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com.au; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=jkgZHy4PAyB9mzjJkM7tGb5PqK5npeZ7Vp92EdzLxEtIbvJa5WMevQn0xlNRmPqE4dsu8tLb0l5Zh5DHAUy1Z/LXypulfw7aoyUKztRCYKXCB809z82C880BKpWE5n298j5BU1SDkwPt9CM7ZLMIdlQMINuO5WfwuezJnhitJYQ= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1294490357; bh=6Y9owJKYa2OA+V3zIFpOMVnJmK0azSWcAQ4dGs6pCa8=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Content-Transfer-Encoding; b=qFGTrkTy8JtIW/u1kurOsF93hPY+HHyua63kxwU9wHiFb0mOdGASdE610RHpcNZfYYUwStY3aSPkMEg4eQa5OXH2JQlkYBSkX4YRBF/X7dd2iy9nd/aW/T+HLdfS++umDEUVunnEaQxM70SCD4LZgm20OPA9cgfaAu2owwYHT0o= Received: from thought.local (mail_ben_schmidt@124.149.85.149 with plain) by smtp139.mail.mud.yahoo.com with SMTP; 08 Jan 2011 04:39:17 -0800 PST X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: b.fL5dAVM1lI15lulNhb3on1b2EC0v0d21_HrEOQkgI5YVF qVYnssAu_sUHhEoAbfiDE7898HU1QzsIjIPkvfZsO762peXudfHgpwW8gO.d ovLCA_BT10cp3qx_OLWDNDnLZpYzuWLbppFgHIvUKRdt2emEKe0E9U7cYDtL 25kW_KScTBsURkhXM6cVTox0Y1s8bCHG7kqFLZ.tPdk.JnafIhuEQPtJ1eQ. P6e.A2meUXRf5GSz1aQrHiAUPhzu9i3OHMDQ_7GKCRZiTFOrEkqUi21KveQt uctPZk3d6.sJazl8GIlrgfDphMbf9VVuaAp4rnyLKtYdpBn_Z9vh4Eh2PSgV VumMHdn_tqEaaGy63MSiW0vlm7Q-- X-Yahoo-Newman-Property: ymail-3 Message-ID: <4D285AF2.2080902@yahoo.com.au> Date: Sat, 08 Jan 2011 23:39:14 +1100 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 ThunderBrowse/3.3.4 MIME-Version: 1.0 To: Stefan Marr CC: internals@lists.php.net References: <4D206CA4.6060004@yahoo.com.au> <9284588E-446F-4C2D-B747-340D2F2D4E25@stefan-marr.de> In-Reply-To: <9284588E-446F-4C2D-B747-340D2F2D4E25@stefan-marr.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Extensions to traits From: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) Hi again, Stefan, Continuing the conversation. On 7/01/11 10:18 AM, Stefan Marr wrote: > On 02 Jan 2011, at 13:16, Ben Schmidt wrote: >> Extension >> - - - - - >> >> I suggest these two problems can be simply solved by introducing two >> additional uses of the trait keyword: as a scoping keyword and an access >> specifier. >> >> As a scoping keyword, it would be used analogously to self. Method calls >> such as $this->print() could be replaced with trait::print() when the >> programmer desires to ensure that their trait method, and only their >> trait method, is called--when there is no intention that overriding >> should be possible. It would only be able to be used in a trait, and >> could only be used to reference methods or properties defined in the >> same trait, using their original name. >> >> As an access specifier, it would be used instead of public, private, >> etc. in trait definitions, to mean that the member (data or method) can >> and can only be accessed using the mechanism above (trait::). > > Ok, that would actually get us around all the meta-programming > problems. > > When you say that the 'trait'-access modifier always requires the > access via a specific keyword (trait::) then mangling the name should > be possible. > > On the other hand, what would iterating over the object properties > show? > > Multiple properties with the same name, like with inherited private > properties I suppose? Well, I hadn't thought about it before. :-) But yes, I think that makes perfect sense. > And an occurrence of trait:: would mean, do a $this-> but mangle the > name first with the trait's name the original definition was in. > Should be possible, but would certainly impact the Zend Engine a bit > more than what we have now. One complication I hadn't thought of before is whether it should be possible to access trait:: methods and properties in different objects. And if it should be, what syntax to use. $that->trait::method() seems somewhat ugly to me. That would also suggest we should use $this->trait::method() for the same-object case. > Certainly an interesting approach. > > Has someone else an opinion on that? I think actually this is the most important part of my proposal, so if it could be accepted, I would be very pleased. Obviously it does need a bit more thought and discussion yet, though. >> Overriding >> ========== >> >> Limitation >> ---------- >> >> At present, the overriding semantics of traits are that a method defined >> in a class proper overrides a method defined in a used trait which in >> turn overrides a method defined in an ancestor class. > > Bye the way, where comes that terminology from: class proper? We are > talking about the body of a class, right? Yes. 'Class proper' = 'class itself'. We seem to use 'proper' in English as an adjective after a noun with a Latin-like sense of 'own/itself'. I guess we probably got it from French, and surprisingly it hasn't died out. Cheers, Ben.