From: merch-redmine@... Date: 2019-09-05T22:44:51+00:00 Subject: [ruby-core:94790] [Ruby master Bug#12984] `rescue *[]` should be equivalent to `rescue` as `method_call(*[])` is equivalent to `method_call` Issue #12984 has been updated by jeremyevans0 (Jeremy Evans). Assignee set to matz (Yukihiro Matsumoto) Status changed from Feedback to Assigned bughit (bug hit) wrote: > I stopped getting email notifications from bugs.ruby-lang.org, to whom should I report this? I'm not sure. > I am going to reopen this because I did not have a chance to address your comment. And I made an argument that so far has not been addressed. Your argument is basically that `rescue *[]` should mean `rescue`. In reality, `rescue` is a shortcut for `rescue *[StandardError]`. If you look at it from that perspective, it is obvious that `rescue *[]` and `rescue *[StandardError]` should not be the same thing. > > It should not mean rescue only exception classes in the array, unless the array is empty > > That's not consistent with the meaning of splatting an empty array, whereas the opposite is. > > In a construct that takes a coma separated list, splatting an empty array produces a void list (no values) > > so `rescue *[Class1, Class2]` translates to `rescue Class1, Class2` > `rescue *[Class1]` translates to `rescue Class1` > and `rescue *[]` to a plain `rescue` which does not mean rescue nothing > > That would be logical and consistent. > > There is no explicit syntax for rescue nothing which would be something like `rescue()`, so `rescue *[]` has to mean `rescue` and not the non-existent `rescue()` The explicit syntax for rescue nothing is `rescue *[]` :) . As I showed in my earlier example, changing `rescue *array` to mean `rescue StandardError` if the array is empty will break backwards compatibility. Assigning to matz to make a decision on this. ---------------------------------------- Bug #12984: `rescue *[]` should be equivalent to `rescue` as `method_call(*[])` is equivalent to `method_call` https://bugs.ruby-lang.org/issues/12984#change-81406 * 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 suppose 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: