[ruby-core:76157] [Ruby trunk Bug#12522][Rejected] Keyword arguments should supercede double-splat arguments

From: nobu@...
Date: 2016-06-27 08:02:47 UTC
List: ruby-core #76157
Issue #12522 has been updated by Nobuyoshi Nakada.

Description updated
Status changed from Open to Rejected

```ruby
foo **{x: 'fallback'}, x: 1
```

----------------------------------------
Bug #12522: Keyword arguments should supercede double-splat arguments
https://bugs.ruby-lang.org/issues/12522#change-59364

* Author: Guyren Howe
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I propose that it is more intuitive (and much better for FREST functions; see #12521) if explicit keyword arguments supercede the double-splat argument, rather than the opposite as it is now.

This:

```ruby
def foo(x:)
  p "Foo x: #{x}"
end

foo x: 1, **{x: 'fallback'}
```

should not print 'fallback'.

I believe that it is more intuitive for the explicit x to supercede the one in the double splat.

Ruby 2 has an amazing and under-utilized ability to sling around, pull apart and combine hashes just in the process of calling functions. I've been exploring where this can take us recently, and #12512 and this would both significantly improve the usefulness and intuitiveness of this language feature.

If we wish to retain the current behavior for compatibility or whatever, then I propose a triple splat or double-colon keyword symmetric with #12512.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next