Re: Re: Make try/catch brackets optinal
| From: | Stas Malyshev | Date: | Fri, 20 Jul 2012 16:55:00 +0000 |
| Subject: | Re: Re: Make try/catch brackets optinal | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-61574@lists.php.net to get a copy of this message | ||
Hi!
>> I've run into problems with brace-less blocks many, many times over
>> the years. Clearly, enough other people have as well that any serious
>> coding standard includes a clause requiring that all blocks use
>> braces. I see no reason to add another context in which braces could
>> be omitted.
Agree, no reason to mess with try/catch at all. However for if there's a
small number of cases where brace-less block if ok, e.g. usually I could
write something like:
foreach($arr as $item) {
if(!good($item)) continue;
do_stuff($item);
}
and it's not that bad to have it brace-less. However anything more than
one-term continue or return or break something like that and you want
braces. Of course, this does not apply to try/catch since nobody does
just "return" inside try-catch.
In any case, I don't see any reason to mess with the braces. There's no
problem we'd be solving and it will only bring trouble and more messy code.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227