From: bughit.github@... Date: 2019-09-06T17:37:05+00:00 Subject: [ruby-core:94808] [Ruby master Bug#12984] `rescue *[]` should be equivalent to `rescue` as `method_call(*[])` is equivalent to `method_call` Issue #12984 has been updated by bughit (bug hit). > The explicit syntax for rescue nothing is rescue *[] :) Splat is not part of the rescue syntax, it composes with it, the same way it composes with other constructs that take a comma separated list (invocations, not sure if there are others). Here's an excerpt from "The ruby programming language" ---------------------------------------------------------- Here���s how we would write a rescue clause to handle exceptions of either of these types and assign the exception object to the variable error: rescue ArgumentError, TypeError => error Here, finally, we see the syntax of the rescue clause at its most general. The rescue keyword is followed by zero or more comma-separated expressions, each of which must evaluate to a class object that represents the Expression class or a subclass. These expressions are optionally followed by => and a variable name. ------------------------------------------------------ It documents the specific synax of rescue but does not even mention the splat, which does not have any special meaning in this context and its general meaning is `*[] == a void list`, so `rescue *[] == rescue` ---------------------------------------- Bug #12984: `rescue *[]` should be equivalent to `rescue` as `method_call(*[])` is equivalent to `method_call` https://bugs.ruby-lang.org/issues/12984#change-81429 * Author: bughit (bug hit) * Status: Assigned * Priority: Normal * Assignee: matz (Yukihiro Matsumoto) * Target version: * ruby -v: ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Splatting an empty array to a construct that takes a list is supposed to be equivalent to specifying no list ```ruby def foo end foo *[] #works ``` So `rescue *[]` should be equivalent to `rescue` ```ruby begin raise 'error' #Uncaught exception rescue *[] puts 'caught' end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: