Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35705 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12941 invoked by uid 1010); 21 Feb 2008 22:34:11 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 12925 invoked from network); 21 Feb 2008 22:34:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 22:34:10 -0000 X-Host-Fingerprint: 81.25.53.50 NAT-81-25-53-50.ultranet.ru Received: from [81.25.53.50] ([81.25.53.50:2136] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/F6-64513-16CFDB74 for ; Thu, 21 Feb 2008 17:34:09 -0500 Message-ID: To: internals@lists.php.net References: <47BD207C.2080905@chiaraquartet.net> Date: Fri, 22 Feb 2008 01:11:53 +0300 Lines: 84 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Original X-Posted-By: 81.25.53.50 Subject: Re: Trait aliasing syntax suggestions From: dmda@yandex.ru ("jvlad") Hi, what's about sample below? in other words, why to introduce such a new thing as trait instead of using classes and trait'ing them? just my two cents. -j "Gregory Beaver" wrote in message news:47BD207C.2080905@chiaraquartet.net... > Hi, > > Here is a slightly clearer syntax for trait instantiation and for > aliasing/removing method names from traits: > > trait foo > { > function bar(){} > function bing(){} > } > > trait bar > { > function bar(){} > } > > class A > { > trait foo; > } > > class B > { > trait foo {unset bing, bar as bing}; > trait bar; > } > ?> > > Simply re-using "trait" instead of "use" is a more self-documenting > solution. I found it slightly confusing to see "use" when that is a > namespace-specific token currently. This is also in keeping with the > way functions are defined in interfaces vs. implementation, but in > reverse (for traits, brackets are used for declaration, semi-colon used > for instantiation). > > Obviously, using "unset" is more similar to current PHP ideas on how to > remove something, and the "as" syntax is also very PHP-ish, these will > be far more self-documenting than the proposed syntaxes I've read thus > far. > > Greg