Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20593 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63748 invoked by uid 1010); 26 Nov 2005 21:39:47 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63731 invoked from network); 26 Nov 2005 21:39:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2005 21:39:47 -0000 X-Host-Fingerprint: 66.216.66.81 mail.ionzoft.com Linux 2.4/2.6 Received: from ([66.216.66.81:43751] helo=mail.ionzoft.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id C3/DE-56276-226D8834 for ; Sat, 26 Nov 2005 16:39:47 -0500 Received: from JASONGARBER2 (207-255-4-232-static.aoo.pa.atlanticbb.net [207.255.4.232]) by mail.ionzoft.com (Postfix) with ESMTP id 5AC318A406E; Sat, 26 Nov 2005 16:40:20 -0500 (EST) Date: Sat, 26 Nov 2005 16:39:44 -0500 X-Mailer: The Bat! (v3.5.25) Professional Reply-To: Jason Garber Organization: IonZoft, Inc. X-Priority: 3 (Normal) Message-ID: <505185212.20051126163944@ionzoft.com> To: Greg Beaver CC: internals@lists.php.net In-Reply-To: <20.BA.56276.A1BC8834@pb1.pair.com> References: <20.BA.56276.A1BC8834@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] namespace separator ideas From: jason@ionzoft.com (Jason Garber) Hello, I as a userland library author, would appreciate namespaces quite a bit. Here is an idea: namespace1..class() $x = new MyApp..MemberOrder(); -- Best regards, Jason mailto:jason@ionzoft.com Saturday, November 26, 2005, 3:52:35 PM, you wrote: GB> Hi all, GB> I have only one caveat with the \ separator, which is that it is a GB> little bit too similar to division with /, and can result in some GB> confusing code like: GB> namespace name1 { GB> class name2{} GB> } GB> define('name1', 1); GB> define('name2', 2); GB> $a = new name1\name2; GB> $b = name1/name2; ?>> GB> The same issue exists with all colon based separators (that sounds bad GB> when read the wrong way...) because of the ternary operator, and :: with GB> static classes/methods. GB> namespace name1 { GB> class name2{} GB> } GB> define('name1', 1); GB> define('name2', 2); GB> // this may be a parse error with the current namespace patch, GB> // but need not be if we use -> GB> class name1 GB> { GB> const name2 = 1; GB> } GB> $a = new name1:::name2; GB> $b = name1::name2; // do you see the difference? I get confused ?>> GB> What about using the T_OBJECT_OPERATOR? This is a parse error in GB> existing versions, and also implies some separation. GB> namespace name1 { GB> class name2{} GB> } GB> define('name1', 1); GB> define('name2', 2); GB> // this may be a parse error with the current namespace patch, GB> // but need not be if we use -> GB> class name1 GB> { GB> const name2 = 1; GB> } $a = new name1->>name2; GB> $b = name1::name2; ?>> GB> I also proposed on IRC using \\ as this is similar to netware driver GB> separators: GB> define('name1', 1); GB> define('name2', 2); GB> $a = new name1\\name2; GB> $b = name1/name2; ?>> GB> However, I know Andrei hated this :). I very much prefer the use of ->, GB> as this has the same advantage as :: of "rhyming" with current syntax. GB> Greg