Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:40588 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77111 invoked from network); 21 Sep 2008 01:00:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2008 01:00:43 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 76.96.30.24 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 76.96.30.24 qmta02.emeryville.ca.mail.comcast.net Received: from [76.96.30.24] ([76.96.30.24:59029] helo=QMTA02.emeryville.ca.mail.comcast.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6A/75-65213-9BC95D84 for ; Sat, 20 Sep 2008 21:00:42 -0400 Received: from OMTA03.emeryville.ca.mail.comcast.net ([76.96.30.27]) by QMTA02.emeryville.ca.mail.comcast.net with comcast id HC8d1a0080b6N64A2D0faM; Sun, 21 Sep 2008 01:00:39 +0000 Received: from earth.ufp ([24.13.255.226]) by OMTA03.emeryville.ca.mail.comcast.net with comcast id HD0e1a00H4trKQ88PD0fft; Sun, 21 Sep 2008 01:00:39 +0000 X-Authority-Analysis: v=1.0 c=1 a=1hixkYUiaj8A:10 a=qdT5W4vwNVQA:10 a=67BIL_jfAAAA:8 a=x7rzUhkAAAAA:8 a=EI3h1TgeBb9KvHDSVSgA:9 a=9OMkAFtHfuMNju1lzFYA:7 a=nPIz_0dpN0EhiGwqOjVd174LS6gA:4 a=FHBbIDN7CdwA:10 a=LY0hPdMaydYA:10 Received: from localhost (localhost [127.0.0.1]) by earth.ufp (Postfix) with ESMTP id 45BEAD7A17 for ; Sat, 20 Sep 2008 20:00:38 -0500 (CDT) Received: from earth.ufp ([127.0.0.1]) by localhost (earth.ufp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7B7PvBeuHRzg for ; Sat, 20 Sep 2008 20:00:38 -0500 (CDT) Received: from luna (unknown [192.168.42.1]) by earth.ufp (Postfix) with ESMTPSA id 26C5AD7A0F for ; Sat, 20 Sep 2008 20:00:38 -0500 (CDT) To: internals@lists.php.net Date: Sat, 20 Sep 2008 20:00:38 -0500 User-Agent: KMail/1.9.9 References: <48D47532.8080102@chiaraquartet.net> <10845a340809201643q59e27211i471e09241f7253b1@mail.gmail.com> In-Reply-To: <10845a340809201643q59e27211i471e09241f7253b1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200809202000.38870.larry@garfieldtech.com> Subject: Re: [PHP-DEV] solving the namespace conflict issues between function/static method class constant/ns constant From: larry@garfieldtech.com (Larry Garfield) On Saturday 20 September 2008 6:43:41 pm Richard Quadling wrote: > >> 5) a simply syntax change to namespaces, introducing a new concept: > >> namespace element. > >> > >> A namespace element is a class, function or constant defined within a > >> namespace declaration: > >> > >> >> namespace foo; > >> class bar {} // class element bar in namespace foo > >> function bar(){} // function element bar in namespace foo > >> const bar=1; // const element bar in namespace foo > >> ?> > >> > >> This is similar to class elements: > >> > >> >> class foo { > >> function bar(){} // method element bar in class foo > >> const bar=1; // constant element bar in class foo > >> public $bar=1; // variable element bar in class foo > >> } > >> ?> > >> > >> Currently, this code: > >> > >> >> namespace foo::bar; > >> class buh{} > >> ?> > >> > >> creates a class named "foo::bar::buh", essentially joining the namespace > >> "foo::bar" and its class element "buh" with the separator "::". This > >> turns out to be the root of the problem with the conflicts between class > >> elements and namespace elements. The last patch introduces a new > >> namespace element operator to delineate the boundary between namespace > >> name and element name. For the patch, I recycled T_OBJECT_OPERATOR (->). > >> > >> current way: > >> >> foo::bar->test(); // namespace foo::bar, call to function element test() > >> foo->bar::test(); // namespace foo, call to static method element test() > >> in class element bar > >> foo->myconst; // namespace foo constant myconst > >> foo::myconst; // class foo constant myconst > >> ?> > >> > >> The patch is at: > >> > >> http://pear.php.net/~greg/ns.element.patch.txt > >> > >> This is the most extensive change. The patch preserves :: as global > >> element accessor (::strlen() calls strlen internal function, for > >> instance). I'm happy to answer any other questions. > >> > >> So, these are the choices. I suggest we all take a rational look at the > >> options, and understand the consequences of each, and make the best > >> choice possible. > >> > >> Thanks, > >> Greg > > > > Good work, but I (and I'm probably not alone) can't really keep up > > with all those namespace threads and proposals for changes and > > resolution fixes and this and that,so : > > > > Please use our nice RFC system! > > > > Regards > > > > -- > > Etienne Kneuss > > http://www.colder.ch > > > > Men never do evil so completely and cheerfully as > > when they do it from a religious conviction. > > -- Pascal > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > How feasible would it be to use # as the namespace separator. I know # > is used for comments, but with /* */ and // that all seems covered. > > namespace#function() vs class::static() > > Seems like a winner. Just a whole ton of BC though for those using # > for comments. I agree that #5 seems like the best solution. The problem is caused by the double meaning of ::. All of the other solutions feel like bandaids. Of course, the problem then is finding a symbol that is not already used. I don't think reusing -> is any wiser than reusing ::. # would be great if it wasn't already in use, but that sort of change is really not appropriate for 5.3. What other symbols are available or could be created? (::: has been suggested and would give the opportunity to introduce more Hebrew into the language parser...) -- Larry Garfield larry@garfieldtech.com