Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20591 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60233 invoked by uid 1010); 26 Nov 2005 21:35:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 60212 invoked from network); 26 Nov 2005 21:35:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2005 21:35:54 -0000 X-Host-Fingerprint: 81.103.221.47 mta07-winn.ispmail.ntl.com Solaris 8 (1) Received: from ([81.103.221.47:24179] helo=mta07-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id B2/5E-56276-A35D8834 for ; Sat, 26 Nov 2005 16:35:54 -0500 Received: from aamta09-winn.ispmail.ntl.com ([81.103.221.35]) by mta07-winn.ispmail.ntl.com with ESMTP id <20051126213551.ZYNF21883.mta07-winn.ispmail.ntl.com@aamta09-winn.ispmail.ntl.com>; Sat, 26 Nov 2005 21:35:51 +0000 Received: from win2ks ([213.107.8.99]) by aamta09-winn.ispmail.ntl.com with ESMTP id <20051126213551.XXBV1233.aamta09-winn.ispmail.ntl.com@win2ks>; Sat, 26 Nov 2005 21:35:51 +0000 Reply-To: To: "'Greg Beaver'" , Date: Sat, 26 Nov 2005 21:36:38 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 In-Reply-To: <20.BA.56276.A1BC8834@pb1.pair.com> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Thread-Index: AcXyy4AEFQZd0/t5Rp6Rtplld5FEgAABG4bw Message-ID: <20051126213551.XXBV1233.aamta09-winn.ispmail.ntl.com@win2ks> Subject: RE: [PHP-DEV] namespace separator ideas From: jared.williams1@ntlworld.com ("Jared Williams") References: <20.BA.56276.A1BC8834@pb1.pair.com> > Hi all, > > I have only one caveat with the \ separator, which is that it > is a little bit too similar to division with /, and can > result in some confusing code like: > > namespace name1 { > class name2{} > } > define('name1', 1); > define('name2', 2); > > $a = new name1\name2; > $b = name1/name2; > ?> > > The same issue exists with all colon based separators (that > sounds bad when read the wrong way...) because of the ternary > operator, and :: with static classes/methods. > > namespace name1 { > class name2{} > } > define('name1', 1); > define('name2', 2); > // this may be a parse error with the current namespace > patch, // but need not be if we use -> class name1 { > const name2 = 1; > } > > $a = new name1:::name2; > $b = name1::name2; // do you see the difference? I get confused ?> > > What about using the T_OBJECT_OPERATOR? This is a parse > error in existing versions, and also implies some separation. > > namespace name1 { > class name2{} > } > define('name1', 1); > define('name2', 2); > // this may be a parse error with the current namespace > patch, // but need not be if we use -> class name1 { > const name2 = 1; > } > > $a = new name1->name2; > $b = name1::name2; > ?> > > I also proposed on IRC using \\ as this is similar to netware driver > separators: > > define('name1', 1); > define('name2', 2); > > $a = new name1\\name2; > $b = name1/name2; > ?> > > However, I know Andrei hated this :). I very much prefer the > use of ->, as this has the same advantage as :: of "rhyming" > with current syntax. Hi, I was thinking -> too.. Had ideas of namespaces being object instances in their own right.. namespace foo { const ACONST = '1'; class bar {} } echo $foo->bar; // some mangled internal class name (foo_bar_123 or something) to make it unique $a = new $foo->bar(); $ref = new ReflectionClass($foo->bar); Jared