I don't think we should add it purely for consistency, because then we'd
have to allow nonsense like:

switch x;
case 1;
endcase;
endswitch;

or...

try;
x;
catch e;
endtry;

Sure, consistency is good, but this would allow sloppy code.
On Jul 20, 2012 8:36 AM, "Amaury Bouchard" <ama...@amaury.net> wrote:

> 2012/7/19 Reeze <reeze....@gmail.com>
>
> > 在 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.
> >
>
> Bad argument. It's not about the presence of a condition after "try". It's
> about language consistency.
> If you were right, we shouldn't be able to write that:
>   $i = 0;
>   do
>       echo($i++);
>   while ($i < 3);
>
> PHP allows it. Nobody cares about it, while I think it's a very ugly
> writing. But everybody is accustomed to it, because it's inherited from C
> syntax.
> And bracketless try/catch doesn't exists in other languages, so it
> shouldn't exists in PHP?
>
> More, do not confuse coding conventions (depends on people, changes from
> time to time) and language syntax (should be stable and consistent).
>

Reply via email to