Actions
Feature #13212
closedSyntax proposal: don't require begin-end to rescue exceptions inside do-end blocks
Feature #13212:
Syntax proposal: don't require begin-end to rescue exceptions inside do-end blocks
Status:
Closed
Assignee:
-
Target version:
-
Description
Blocks are ubiquitous in Ruby world. There's as many blocks in every Ruby code as methods - if not even more. It would be very nice to treat blocks as first class citizens like methods and reduce the undesirable begin-end boilerplate inside blocks for exception handling. Here's the syntax proposal:
Just like in methods:
Currently begin-end block is required for handling exceptions inside blocks:
Whether the same syntax would apply for {} block/lambda syntax is debatable. {} are typically one-liners and I barely ever saw a begin-rescue-end inside them.
Thank you
-Damian Nowak
Updated by hsbt (Hiroshi SHIBATA) over 9 years ago
- Has duplicate Feature #12906: do/end blocks work with ensure/rescue/else added
Updated by hsbt (Hiroshi SHIBATA) over 9 years ago
- Status changed from Open to Closed
It's accepted by https://bugs.ruby-lang.org/issues/12906
You can use this syntax after Ruby 2.5.
Actions