Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51510 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18154 invoked from network); 23 Feb 2011 10:16:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2011 10:16:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=mail_ben_schmidt@yahoo.com.au; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=mail_ben_schmidt@yahoo.com.au; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com.au from 98.139.53.208 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.53.208 nm17-vm0.bullet.mail.ac4.yahoo.com Received: from [98.139.53.208] ([98.139.53.208:43291] helo=nm17-vm0.bullet.mail.ac4.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/23-32612-D8ED46D4 for ; Wed, 23 Feb 2011 05:16:46 -0500 Received: from [98.139.52.190] by nm17.bullet.mail.ac4.yahoo.com with NNFMP; 23 Feb 2011 10:16:42 -0000 Received: from [98.139.52.179] by tm3.bullet.mail.ac4.yahoo.com with NNFMP; 23 Feb 2011 10:16:42 -0000 Received: from [127.0.0.1] by omp1062.mail.ac4.yahoo.com with NNFMP; 23 Feb 2011 10:16:42 -0000 X-Yahoo-Newman-Id: 694852.86574.bm@omp1062.mail.ac4.yahoo.com Received: (qmail 31303 invoked from network); 23 Feb 2011 10:16:42 -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=s0tWirUBvqGVtsCKc8ZwVi9s+HwsKRarJk7uuD278cXA43ZfR+R/B2a2WhrwDRiZklZ7DT9/WqomLDQ9KSJiTCU6iZXTh+dVk6ghM7j3KFIi2z9jTNb/mWaubYk6DUb7se/6WF68A1svmmR9b4vEi4GMzYFRdNWiRtLdEORyLZo= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.au; s=s1024; t=1298456202; bh=HtUORVFbFrd4eIVCirX8EtAKC+6c1gwy5Mz+kPLQo6s=; 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=mRbCRUkQL00kUHcyRoEDtyW4jz/FObEBImqwPKi49RaoaxsGe3u6R3K/tyBdKKA2v9/mi6GZ6QEdWR4NQ9N8ClFpfZelnpaQTZ4Z1i79FiXUC7h01LH24e8XzDL2QJbcukSoSw6Oh9NRSk1AhPIOU8PPUGH+CEkrGF11+ck2aNI= Received: from thought.local (mail_ben_schmidt@124.168.90.55 with plain) by smtp135.mail.mud.yahoo.com with SMTP; 23 Feb 2011 02:16:41 -0800 PST X-Yahoo-SMTP: enFMnPSswBAexaHyzgobwuUTrYOhZdJ0KRA2SjA- X-YMail-OSG: NdYZaOwVM1nBSXS9aTu4agLCBcgDqHvBSIDlOKMYKfLICKF ymQ8M1uXA6Zg1HY52BgT_uLNQ87___g6Eb3V.XgJOjloxyBwc.lCRTCKCSn5 2_8NayKLYhWS09XhFLV41zat3.k97Y3.oYZqHwbFc13e2e.6S9PRUsgb1z_v g_9VmpJUamqecaGSy7qB1fAxg6rXYwwVCkTHYWX7KHve3Y3fRP.41MMKj0PS oN9oRG1Wemy5AyQMCeBjE_NWAP.rHAL8fT32y7shyqOZDIKr5qJmjYfLbGz2 2CDHQyg_ycmOV X-Yahoo-Newman-Property: ymail-3 Message-ID: <4D64DE87.1090402@yahoo.com.au> Date: Wed, 23 Feb 2011 21:16:39 +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: =?UTF-8?B?QW5kcsOpIFLDuG1ja2U=?= CC: internals@lists.php.net 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: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Extensions to traits From: mail_ben_schmidt@yahoo.com.au (Ben Schmidt) On 13/02/11 9:15 PM, André Rømcke wrote: > On Thu, Feb 10, 2011 at 6:25 PM, Ben Schmidt > wrote: > >> On 11/02/11 3:37 AM, Philip Olson wrote: >> >>> You now have rights to the wiki rfc namespace. >>> >> >> Thanks a lot, Philip. >> >> I have now made an RFC based on the most recent discussions: >> >> http://wiki.php.net/rfc/traitsmodifications >> >> I think this is a more solid proposal than my original one, and I hope >> we can continue to discuss it and agree to the extent that it's worth >> starting an implementation. >> >> Please read it and comment whenever you can find some time, guys! >> > > > As for your first example: > > > trait T { > public function foo() { > echo "T"; > }}class C { > use T; > public function foo() { > echo "C"; > }} > > > I think it would sometimes be desirable to allow this, for instance when a > trait has been updated in a framework to adapt to what has become common > practice in classes that uses it in the wild. > ( I assume you already get error if function signature is different like in > inheritance? ) > > So to allow both cases, what about letting people use the final keyword on > functions to signal functions that can not be re declared without alias. Or > better, add a new keyword since final should mean final. I don't mind that idea all that much, but perhaps doing the reverse makes more sense: allowing a trait author to add a keyword to methods which they intend and expect class authors to shadow. This means the status quo is leaning towards stability, not breakages. Perhaps we could reuse the 'default' keyword for this? That would indicate that the trait has provided a default implementation of this method, but expects the class author may well provide a more specialised implementation. Best practice would then dictate that a responsible trait author should only provide a default method for methods that were previously abstract methods of the trait, so things wouldn't break, but traits can still adapt to common practice, as you say. So then this would generate an error, which could be resolved with an insteadof in the use block: trait T { public function foo() { echo "T"; } } class C { use T; public function foo() { echo "C"; } } But this would not: trait T { default public function foo() { echo "T"; } } class C { use T; public function foo() { echo "C"; } } How does that sound? Ben.