On Tue, Jun 25, 2013 at 12:54 AM, Joost Koehoorn
<joost.koeho...@gmail.com>wrote:

> Hi all,
>
> I just published an RFC that proposes to add catch-statement without
> needing to specify a variable, and support for fully anonymous catches.
>
> Details can be found at:
>
> https://wiki.php.net/rfc/anonymous_catch
>

No opinion on leaving off $e, but I'm against the generic catch{} statement.

Looking at the Python docs, they don't see particularly fond of the
wildcard-except themselves:

> The last except clause may omit the exception name(s), to serve as a
wildcard. Use this with extreme caution, since it is easy to mask a real
programming error in this way! It can also be used to print an error
message and then re-raise the exception (allowing a caller to handle the
exception as well):

Furthermore a wildcard-catch is bad for forwards compatibility. Right now
all exceptions extend Exception, but this doesn't have to stay so. E.g.
Python has additional exceptions above that for handling stuff like signal
interrupts or die()s and I think it's not unlikely that we will introduce
something like this in PHP too. You normally do *not* want to catch those,
but a wildcard-catch would do this.

Thus I think it's better to stays explicit and keep it at catch(Exception).

Nikita

Reply via email to