Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47895 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56544 invoked from network); 12 Apr 2010 21:05:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Apr 2010 21:05:08 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@stefan-marr.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@stefan-marr.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain stefan-marr.de from 85.88.12.247 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 85.88.12.247 toolslave.net Received: from [85.88.12.247] ([85.88.12.247:41854] helo=uhweb12247.united-hoster.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C6/47-13867-FFA83CB4 for ; Mon, 12 Apr 2010 17:05:06 -0400 Received: from cust194-138.dsl.as47377.net ([62.166.194.138] helo=[192.168.0.16]) by uhweb12247.united-hoster.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.69) (envelope-from ) id 1O1Qnt-0004YD-Hq; Mon, 12 Apr 2010 23:04:27 +0200 Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii In-Reply-To: <003701cada4a$196d29a0$4c477ce0$@com> Date: Mon, 12 Apr 2010 23:04:43 +0200 Cc: "'Lukas Kahwe Smith'" , "'Derick Rethans'" , "'PHP Developers Mailing List'" Content-Transfer-Encoding: quoted-printable Message-ID: <93850919-9510-4766-BE8B-06A17494B544@stefan-marr.de> References: <03128BF8-9EAC-4BAC-AAFE-6D8AA21153DC@pooteeweet.org> <4DA7D942-6BF1-4A0F-AECF-3EB82900798D@stefan-marr.de> <003701cada4a$196d29a0$4c477ce0$@com> To: Jonathan Bond-Caron X-Mailer: Apple Mail (2.1078) Subject: Re: [PHP-DEV] Traits From: php@stefan-marr.de (Stefan Marr) On 12 Apr 2010, at 16:11, Jonathan Bond-Caron wrote: > On Mon Apr 12 05:16 AM, Stefan Marr wrote: >>=20 >> On 12 Apr 2010, at 10:39, Lukas Kahwe Smith wrote: >>> On 12.04.2010, at 10:34, Derick Rethans wrote: >>>> Hi! >>>>=20 >> But just as a quick response, without aliasing, there would be no way=20= >> to use a conflicting method from a trait. >> On first sight, that is not a really good thing. >=20 > Hi Stefan, is it possible to have renaming and aliasing?=20 >=20 > Some context, say we have:=20 >=20 > trait Something {=20 > function renameIssue() { > $method =3D 'call'; > $this->$method(); > call_user_func(array($this, $method)); > } > function call () { echo "a"; } function invokeCallDirectly() { $this->call(); } > } >=20 > class Foo { > use Something { > function call() as call2(); > } > } >=20 > With renaming: >=20 > $f =3D new Foo; > $f->call2(); // a > $f->renameIssue(); // call() method does not exist I have added invokeCallDirectly() to your example. What should be the = semantics of that? Should that call be refitted to invoke call2?=20 Am not sure that this is a good idea, with all this other ways around to = call methods dynamically. Ok, aliasing is 'kind of annoying' and unusual = but from my perspective not much different then what we do with = variables every day. They reference objects, and we introduce new = aliases for old objects every now and then. > the syntax could re-use the 'clone' keyword: >=20 > class Foo { > use Something { > function call() clone call2(); > } > } Would be an option, but it reads kind of strange, doesn't it? Best regards Stefan --=20 Stefan Marr Software Languages Lab Vrije Universiteit Brussel Pleinlaan 2 / B-1050 Brussels / Belgium http://soft.vub.ac.be/~smarr Phone: +32 2 629 2974 Fax: +32 2 629 3525