ActionsLike0
Feature #10042
closedDeprecate postfix rescue syntax for removal in 3.0
Description
The postfix rescue notation is convenient...but almost always is a really bad antipattern.
An example of the notation:
Integer(f) rescue f # returns f if it is not parseable as an Integer
It silently ignores all StandardError raised by a piece of code...which often covers many more exceptions than the user wants to be ignoring.
It also hides the cost of constructing and throwing away all those ignored exceptions.
I believe Matz has even said in the past that he regrets adding the feature.
In any case, I propose that "rescue nil" should be deprecated with a warning (either always on or only when verbose) and we should plan to remove it in 3.0.
Who's with me?!
Updated by nobu (Nobuyoshi Nakada) over 10 years ago
- Tracker changed from Bug to Feature
Updated by matz (Yukihiro Matsumoto) over 10 years ago
- Assignee set to matz (Yukihiro Matsumoto)
- Target version changed from 2.6 to 3.0
Updated by duerst (Martin Dürst) about 7 years ago
- Related to Feature #6739: One-line rescue statement should support specifying an exception class added
Updated by naruse (Yui NARUSE) over 4 years ago
- Status changed from Open to Feedback
- Target version deleted (
3.0)
ActionsLike0