Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35704 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8018 invoked by uid 1010); 21 Feb 2008 22:09:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 8003 invoked from network); 21 Feb 2008 22:09:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Feb 2008 22:09:44 -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 82.96.83.42 cause and error) X-PHP-List-Original-Sender: php@stefan-marr.de X-Host-Fingerprint: 82.96.83.42 serv6.servweb.de Linux 2.4/2.6 Received: from [82.96.83.42] ([82.96.83.42:51834] helo=serv6.servweb.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/86-64513-5A6FDB74 for ; Thu, 21 Feb 2008 17:09:42 -0500 Received: from [192.168.0.25] (toolslave.net [85.88.12.247]) by serv6.servweb.de (Postfix) with ESMTP id 266745903B8 for ; Thu, 21 Feb 2008 23:11:10 +0100 (CET) Message-ID: <47BDF6A5.1020302@stefan-marr.de> Date: Thu, 21 Feb 2008 23:09:41 +0100 Reply-To: php@stefan-marr.de User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Internals Mailing List Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Redirected: By TestProxy Subject: RFC Traits: Alternative Syntax Proposals From: php@stefan-marr.de (Stefan Marr) Hi, have updated the RFC and added several syntax proposals. Additionally I've ported the patch to PHP_5_3 (http://toolslave.net/snapshots/traits/traits-5.3.patch). Kind Regards Stefan :Version: 1.2 :HTML: http://www.stefan-marr.de/artikel/rfc-traits-for-php.html :TXT: http://www.stefan-marr.de/rfc-traits-for-php.txt Alternative Syntax Proposals ---------------------------- This section collects proposals for alternative Traits syntaxes. Alternative Keywords for use """""""""""""""""""""""""""" The keyword use is already reserved for the new namespace feature. Thus, alternative keywords has been proposed on the mailing list. The general idea remains the same, Trait usage is defined in the class body like this:: class Foo { class Foo { exhibit Bar; possess Bar; } } Proposed keywords: * use (but already used for namespaces) * exhibit or exhibits (not basic vocabulary?) * possess or possesses (hard to write?) * attach * acquire * adopt * apply * has * consume * implement (almost the like ``implements``) * include (but also ambiguous) * trait Alternative Expression of Exclusion """"""""""""""""""""""""""""""""""" Some people do not like the notation with the exclamation mark. Possible alternative keywords for following notation style:: use Trait { use Trait { not foo1, foo2; without foo1, foo2; } } Keywords: * ! (not readable?) * not * hide (not exactly the meaning of exclusion) * ignore * without * unset * except (may be mistaken with exception stuff) Alternatives for the Aliasing Notation """""""""""""""""""""""""""""""""""""" Aliasing is often misunderstood as renaming. May be some of the following notations will help:: [1] is keyword instead of the arrow use Trait { bar is foo1; //methodAlias is method } Interpretation: ``is`` state something about ``bar``, there is nothing stated about ``foo1``. Alternative keyword for the same notation meaning: * as * alias * from Or an very explicit variation:: [2] from use Trait { alias bar as foo1; }