Project

General

Profile

Actions

Bug #13404

closed

Hash#any? yields arguments to lambdas with proc semantics

Added by nelhage (Nelson Elhage) over 7 years ago. Updated over 7 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
[ruby-core:80580]

Description

l = ->(a, b) { true }

# Raises; Uses Enumerable#all?
{1 => 2}.all?(&l)

# Does not raise; Uses specialized Hash#any?
{1 => 2}.any?(&l)

The Enumerable behavior was changed (correctly) in #12705, but the Hash#any? implementation (introduced in r46866) still allows the lax behavior.


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #13391: wrong number of arguments error for Hash#map when lambda givenClosedko1 (Koichi Sasada)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0