From: "matz (Yukihiro Matsumoto) via ruby-core" Date: 2026-11-19T07:41:53+00:00 Subject: [ruby-core:127617] [Ruby Feature#22485] ensure modifier Issue #22485 has been updated by matz (Yukihiro Matsumoto). Status changed from Open to Rejected I am not going to accept this proposal. `ensure` is for cleanup that spans multiple statements after acquiring a resource. Attaching cleanup to a single expression is rare, and methods that take a block usually cover that case. The value would also be confusing. With the `rescue` modifier the right-hand side becomes the value, but with `ensure` it would be discarded. The `rescue` modifier itself is a frequent source of confusion, so I don't want to add another modifier of the same kind. The benefit does not justify new syntax. Matz. ---------------------------------------- Feature #22485: ensure modifier https://bugs.ruby-lang.org/issues/22485#change-120136 * Author: UlyssesZhan (Ulysses Zhan) * Status: Rejected ---------------------------------------- Similar to the `rescue` modifier, an `ensure` modifier allows writing `ensure` block in one line: `do_something ensure clean_up`. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/