Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:35719 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 66214 invoked by uid 1010); 22 Feb 2008 05:56:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 66199 invoked from network); 22 Feb 2008 05:56:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2008 05:56:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=greg@chiaraquartet.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=greg@chiaraquartet.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain chiaraquartet.net from 38.99.98.18 cause and error) X-PHP-List-Original-Sender: greg@chiaraquartet.net X-Host-Fingerprint: 38.99.98.18 beast.bluga.net Linux 2.6 Received: from [38.99.98.18] ([38.99.98.18:51946] helo=mail.bluga.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/9D-64513-1146EB74 for ; Fri, 22 Feb 2008 00:56:34 -0500 Received: from mail.bluga.net (localhost.localdomain [127.0.0.1]) by mail.bluga.net (Postfix) with ESMTP id 52F1BC101ED; Thu, 21 Feb 2008 22:56:31 -0700 (MST) Received: from [192.168.0.106] (CPE-76-84-4-101.neb.res.rr.com [76.84.4.101]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.bluga.net (Postfix) with ESMTP id DF617C101EC; Thu, 21 Feb 2008 22:56:30 -0700 (MST) Message-ID: <47BE6413.6090507@chiaraquartet.net> Date: Thu, 21 Feb 2008 23:56:35 -0600 User-Agent: Thunderbird 2.0.0.6 (X11/20071022) MIME-Version: 1.0 To: Christian Schneider CC: internals Mailing List References: <47BD207C.2080905@chiaraquartet.net> <47BD928E.8080006@cschneid.com> In-Reply-To: <47BD928E.8080006@cschneid.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: Trait aliasing syntax suggestions From: greg@chiaraquartet.net (Gregory Beaver) Christian Schneider wrote: > So my favourite solution (apart from allowing include in class > definitions ;-)) would be > trait foo { ... } > ... > class B > { > trait foo; # All functions from foo > trait bar(a); # Only function a from bar > trait qux(not b); # Everythign but function b > trait quux(c as d); # Include c but rename it to d > trait quuux(not b, c as d); # Combination of the above > } I could live with most of this as well. "trait bar(a);" is really confusing - it looks like a function call and is not nearly as clear as the other options. It's unlikely to be necessary since a trait should really only have a few functions in it anyways. > Note: The inclusion of specific functions acts as if a "not *" (while * > doesn't really need to be implemented neither for inclusion nor > exclusion IMHO) was given first. > > Another detail: The implementation of the parser changes should still > allow a class or function called "trait", i.e. "trait" should only be a > keyword at specific positions in the source to avoid unneccesary BC > breaks. The current patch has this BC problem. This is not possible to implement, having tried to do a similar thing for 'import' and 'namespace.' The reason is that we can encounter a classname at any point thanks to "classname::whatever" syntax, so it slows the lexer down a bit in that for every T_TRAIT we would have to check to see if the next 2 characters are ::, and makes the lexer uber-complicated. It's a big mess. Greg