Very good point

namespace stuff ;
{
        function myfunction() {
                return true ;
        }
}

That would actually work, but it's not quite the same as you have the
semicolon after the namespace declaration, which looks kind of stupid.
Overall i dont think braces are a bad idea.

People say multiple namespaces per file are confusing, but braces would
partially solve this. If using braces makes multiple namespaces per file
more likely, I say that's the way to go, as I am very much in favor of
multiple namespaces per file.

On Fri, 2007-12-07 at 15:10 -0500, Robert Cummings wrote:
> 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!
> ...........................................................
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to