Issue #11048 has been updated by bug hit.


Yukihiro Matsumoto wrote:
> We don't care about consistency here. Block does not report ArgumentError for reasons,

What are those reasons?  And why do they not apply to keyword arguments?

> so if you have any real-world use case that require keyword argument tolerance, just tell me.

The real-world use case is that anyone who has learned that blocks intentionally tolerate arity mismatches, would expect the same for keyword args and will therefore be unpleasantly surprised and be more likely to introduce a bug.

And that's the value of consistency (or least surprise), behavior that is logically consistent, that can be inferred without having to remember countless of arbitrary special case rules, avoids surprise and bugs.

Since you value programmer joy, there is little joy in having to keep track of incoherent, inconsistent special case rules.



----------------------------------------
Bug #11048: blocks raise on missing and extra keyword args
https://bugs.ruby-lang.org/issues/11048#change-52883

* Author: bug hit
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* ruby -v: ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
blocks intentionally tolerate arity mismatches

```
irb(main):001:0> proc{|a, b| [a, b]}.(1)
[
  [0] 1,
  [1] nil
]

irb(main):003:0> proc{|a, b|[a, b]}.(1, 2, 3)
[
  [0] 1,
  [1] 2
]


```

so why not missing keyword args?

```
irb(main):002:0> proc{|a:, b:|[a, b]}.(a: 1)
ArgumentError: missing keyword: b


irb(main):004:0> proc{|a:, b:|[a, b]}.(a: 1, b: 1, c: 1)
ArgumentError: unknown keyword: c

```




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