Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:20589 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51733 invoked by uid 1010); 26 Nov 2005 21:19:21 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51718 invoked from network); 26 Nov 2005 21:19:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2005 21:19:21 -0000 X-Host-Fingerprint: 64.233.162.202 zproxy.gmail.com Linux 2.4/2.6 Received: from ([64.233.162.202:14686] helo=zproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id D3/3D-56276-951D8834 for ; Sat, 26 Nov 2005 16:19:21 -0500 Received: by zproxy.gmail.com with SMTP id l1so609899nzf for ; Sat, 26 Nov 2005 13:19:18 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Md5Sw+3qQ12MaRwGAkYBjEMd7aw8V6AocerSX0KgLAvSx4ND2f9YCqotGsQ14euPhQ8AhzOXjuq+3QXwQbdENxvaEY+FW0LHqDAROG8RYG1qG/mPYxidKcFOc/4RvCNXe2JqElRkpppV/zR3mdGHQz5VwX2AdbkG66sr0Cs0V2k= Received: by 10.65.15.10 with SMTP id s10mr1075071qbi; Sat, 26 Nov 2005 13:19:18 -0800 (PST) Received: by 10.65.44.6 with HTTP; Sat, 26 Nov 2005 13:19:18 -0800 (PST) Message-ID: Date: Sat, 26 Nov 2005 16:19:18 -0500 To: internals@lists.php.net In-Reply-To: <4388CE54.6060606@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <20.BA.56276.A1BC8834@pb1.pair.com> <4388CE54.6060606@gmail.com> Subject: Re: [PHP-DEV] Re: namespace separator ideas From: matt.friedman@gmail.com (Matt Friedman) Hi, I've been following your conversations all day and think I might have a nice idea for the namespace separator idea. Sorry to barge in on your conversation but I think the following has value. What about something like <- or <:: or even just <: It makes sense to me because a namespace is akin to a parent of the class and in a diagram I would use an arrow to point to the parent from the child. At least there is some type of parent <- child relation. examples: Namespace <:: ClassName or Namespace <- ClassName or Namespace <: ClassName Unless I'm missing something these symbols should not conflict with other ones. They also have more a PHP "feel". This is the most semantically pleasing for me and it mirrors a common convention and represents the actual relationship. In the language it is nice when the symbols have an appearance representative of the actual relationship. When I see \ I think of ugly Windoze file paths. Also ::: seems awkward som= ehow. Matt. On 11/26/05, Jessie Hernandez wrote: > I personally don't like any of these, but I just thought of this one: > "%%". Don't think it'll cause any problems at all, and look at the code: > > $a =3D new name1%%name2; > $b =3D name1::name2; // I see the difference clearly > ?> > > > What do you think? ":::" is more intuitive for me, but "%%" is an > acceptable alternative... > > > Regards, > > Jessie > > > Greg Beaver wrote: > > 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 =3D new name1\name2; > > $b =3D 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 :: wit= h > > 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 =3D 1; > > } > > > > $a =3D new name1:::name2; > > $b =3D 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 =3D 1; > > } > > > > $a =3D new name1->name2; > > $b =3D name1::name2; > > ?> > > > > I also proposed on IRC using \\ as this is similar to netware driver > > separators: > > > > > define('name1', 1); > > define('name2', 2); > > > > $a =3D new name1\\name2; > > $b =3D 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. > > > > Greg > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -- Matt Friedman