Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35613 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13850 invoked by uid 1010); 19 Feb 2008 21:02:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 13835 invoked from network); 19 Feb 2008 21:02:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2008 21:02:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=stefan.marr.de@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=stefan.marr.de@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.162.177 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: stefan.marr.de@gmail.com X-Host-Fingerprint: 209.85.162.177 el-out-1112.google.com Linux 2.4/2.6 Received: from [209.85.162.177] ([209.85.162.177:48158] helo=el-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/F7-55225-0F34BB74 for ; Tue, 19 Feb 2008 16:02:40 -0500 Received: by el-out-1112.google.com with SMTP id n30so1209293elf.17 for ; Tue, 19 Feb 2008 13:02:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; bh=LaQsn8MOrBX3VhQEjDoaGaIrCnStGXYnoyDT49+CZO8=; b=h5KsItgYa5AJ3KDI0SSaHLWwqIngHYoaRIPbUjT9OyMHzXDaXUDO+jZsG1E8xTz6Q9q0rGwD3Alk4Vz0R6eIpbrvLgMdMmg7ncmbJVNebOCDexB8rVz+K6VbOlRG3GTlotIiavagDxwb25O0huVlVOiWM3p39AwDV21s6slgeJc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=eUY0Ec6v9VtHBO0CInlhJ0Za41OGexOCWob437iZyyxp+pm7GTykMP1gq92YYBsmFfi4gnpcoS5ByLPfSBJ/E3OTxw7sACXXWIKoGaIPO3rqcdG87lAJ+cO1/r0McdLFuQAreqD/ec6IRIqBEIi1RGUijOgo1gX/yPCPTfWCHt8= Received: by 10.142.76.4 with SMTP id y4mr5741883wfa.110.1203454957372; Tue, 19 Feb 2008 13:02:37 -0800 (PST) Received: by 10.142.141.2 with HTTP; Tue, 19 Feb 2008 13:02:37 -0800 (PST) Message-ID: <1e12984d0802191302g8a55b1ak748419b16163ee4@mail.gmail.com> Date: Tue, 19 Feb 2008 22:02:37 +0100 Sender: stefan.marr.de@gmail.com To: "Marcus Boerger" , "troels knak-nielsen" Cc: internals@lists.php.net, "=?ISO-8859-1?Q?Johannes_Schl=FCter?=" , "Sebastian Bergmann" , "Alexandre Bergel" , "Falko Menge" , "Sara Golemon" , derick@php.net In-Reply-To: <173732199.20080219175837@marcus-boerger.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <001c01c87264$3c01b4e0$b4051ea0$@de> <173732199.20080219175837@marcus-boerger.de> X-Google-Sender-Auth: 56fe25a3f8605bad Subject: Re: [PHP-DEV] RFC: Traits for PHP From: php@stefan-marr.de ("Stefan Marr") Hi Marcus, Hi Troels, > The biggest issue I see is finding a syntax everyone likes. Well, lets try some variations. > Since renaming happens in a php array like > style I would prefer to have that approach apply for ignoring methods as > well. The way to do that imo is 'method=>false' or 'method=>NULL' which both > should be obvious to PHP programmers that heard about Traits. At first I'll have to make this clear. Aliasing != renaming. It is not renaming operation. Aliasing will give you an additional name for a method body. By example: trait Foo { public function foo() {echo 'foo';} } class FooFoo { use Foo { bar => foo } } This will eventually result in the following class at runtime: class FooFoo { /* RUNTIME */ public function foo() { echo 'foo';} public function bar() { echo 'foo';} } My idea behind this notation was the key => value thing use Trait { additionalMethodName => method } but may be we should use a keyword here which will be more clear. Troels ask for a separation of aliases and exclusions. Here are some notation proposals: [1] Explicit Except/Without List use Trait except foo1, foo2 { bar => foo1 } the keyword except could may be replaced by exceptfor or without if it fits better. [2a] ! is not readable --> except use Trait { except foo1, foo2; bar => foo1 } [2b] ! is not readable --> without use Trait { without foo1; without foo2; bar => foo1; } [Aa] Aliasing is not obvious use Trait { bar is foo1; //aliasMethod is method } [Ab] Aliasing is not obvious use Trait { bar from foo1; //aliasMethod from method } I'm not sure about Aa and Ab because they do not read well in my opinion. What do you think?