Re: [RFC] Optional Catch Block Body
| From: | Mihail Liahimov | Date: | Fri, 08 Aug 2025 05:57:09 +0000 |
| Subject: | Re: [RFC] Optional Catch Block Body | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128429@lists.php.net to get a copy of this message | ||
Yeah, it seems to be problematic to use this syntax with finally blocks.
Perhaps the optional catch block should be allowed only at the very end,
but it sounds somehow doubtful.
ср, 6 авг. 2025 г. в 16:52, Andreas Heigl <andreas@heigl.org>:
> Hey Mihail
>
> Am 06.08.25 um 13:34 schrieb Mihail Liahimov:
> > Hi!
> >
> > At the moment, I can suggest this syntax:
> >
> > try {
> > // do something
> > } catch (SomeIgnorableException) finally {
> > // do something
> > }
> >
> I find that ... challenging
>
> When reading the code I now have to go to the end of the line to
> understand that the second
>
> // do something
>
> does not belong to the
try but to the
> finally...
>
>
> And
>
> try {
> // break stuff
> } catch (SomeIgnorableException)
> finally {
> // do something regardless
> }
>
> seems boken due to the missing }
>
> But well....
>
> We just have to adapt to something like this:
>
> try {
> // break stuff
> }
> catch (SomeIgnorableException)
> catch (Some OtherIgnorableException)
> finally {
> // do something regardless
> }
>
> --
> ,,,
> (o o)
> +---------------------------------------------------------ooO-(_)-Ooo-+
> | Andreas Heigl |
> | mailto:andreas@heigl.org N
> 50°22'59.5" E 08°23'58" |
> | https://andreas.heigl.org
> |
> +---------------------------------------------------------------------+
> | https://hei.gl/appointmentwithandreas
> |
> +---------------------------------------------------------------------+
> | GPG-Key: https://hei.gl/keyandreasheiglorg
> |
> +---------------------------------------------------------------------+
>
>