Hi,

在 2012年7月19日星期四,下午6:45,Rune Kaagaard 写道:

> +1 for the consistency of it. It's surprising that:
>  
> if ($foo)
> return $bar;
> else
> return 42;
>  
> works and:
>  
> try
> maybe_dangerous();
> catch(Dynamite $e)
> handle_error();
>  
>  

There is no condition after `try`, it's really hard to read without bracket.  
it becomes even worse if it didn't format pretty as above.
> does not.
>  
> On Thu, Jul 19, 2012 at 12:11 PM, Peter Beverloo <pe...@lvp-media.com 
> (mailto:pe...@lvp-media.com)> wrote:
> > On Thu, Jul 19, 2012 at 11:06 AM, Rafael Dohms <lis...@rafaeldohms.com.br 
> > (mailto:lis...@rafaeldohms.com.br)>wrote:
> >  
> > > On Thu, Jul 19, 2012 at 12:03 PM, Charlie Somerville <
> > > char...@charliesomerville.com (mailto:char...@charliesomerville.com)> 
> > > wrote:
> > >  
> > > > This has code readability problem written all over it. When maintaining
> > > it
> > > > also has problems, like with the bracket-less if's.
> > > > You would need to add brackets if you add an extra line here, as well as
> > > > you might get unexpected behaviour of you forget to
> > > > add brackets in that case.
> > > >  
> > > > I've often heard people make this argument, but I've never found it to 
> > > > be
> > > > a real concern in practise.
> > > >  
> > > > Is this really such a common problem?
> > >  
> > > I have seen this problem happen, people losing time trying to figure out
> > > what is wrong only to find
> > > its a missing bracket.
> > > As Paul said, this is bug-prone.
> > >  
> >  
> >  
> > Other bracket-less blocks allow authors to shoot themselves in the foot
> > equally so, yet PHP supports these as well. The actual problem here is an
> > inconsistency in the parser, which I'd consider to be a bug.
> >  
> > Peter
> >  
> >  
> > > --
> > > Rafael Dohms
> > > PHP Evangelist and Community Leader
> > > http://www.rafaeldohms.com.br
> > > http://www.phpsp.org.br
> > >  
> >  
> >  
>  
>  
> --  
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>  
>  


Reply via email to