Re: Namespace

From: Date: Fri, 07 Dec 2007 20:10:10 +0000
Subject: Re: Namespace
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-33849@lists.php.net to get a copy of this message
On Fri, 2007-12-07 at 14:57 -0500, Ken Stanley wrote: > In regards to the braces or no braces question, I have a scenario that I > would like to share that could be considered similar in nature. We use a > cluster of databases where I work, and to make things easier on us, we have > a method called setSource() to switch between the clusters in our database > class. This allows us to easily query between the clusters, but since there > are no braces, we sometimes lose track of which cluster we are working on, > and thus bugs are born. I would think that if it were some how possible to > have braces, it would cause less headaches and problems, because we could > then logically group our queries together. The same argument could be used > with namespaces; especially _if_ the multiple namespace-per-file gets added. > Even without that little bit of functionality, it would make maintaining > namespaced code easier to read at first glance. For small apps, it probably > wouldn't be that big of a difference, but for files that span hundreds (and > even thousands) of lines of code, a developer could easily get lost in in > the namespace they are supposed to be in. Am I in a namespace? Which > namespace? Without the code block, and typical indentation, you could easily > overlook the namespace keyword. > > Anyways, I understand that braces are just a bit of icing on the cake -- so > to speak -- but I just wanted to give a probable real-life situation to this > debate. :) Is there any reason why you can't already use braces optionally? I mean, the following code is valid with the current engine: <?php { { { class Foo { function Foo() { echo 'Foo'."\n"; } } } } } ?> Cheers, Rob. -- ........................................................... SwarmBuy.com - http://www.swarmbuy.com Leveraging the buying power of the masses! ...........................................................

« previous php.internals (#33849) next »