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

From: guyren@...
Date: 2016-06-27 06:10:16 UTC
List: ruby-core #76155
Issue #12522 has been reported by Guyren Howe.

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

* Author: Guyren Howe
* Status: Open
* 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:

```
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