ruby-core

Mailing list archive

[ruby-core:82056] [Ruby trunk Bug#13404][Rejected] Hash#any? yields arguments to lambdas with proc semantics

From: hsbt@...
Date: 2017-07-14 08:32:51 UTC
List: ruby-core #82056
Issue #13404 has been updated by hsbt (Hiroshi SHIBATA).

Status changed from Open to Rejected

We continues to discuss #13391

----------------------------------------
Bug #13404: Hash#any? yields arguments to lambdas with proc semantics
https://bugs.ruby-lang.org/issues/13404#change-65784

* Author: nelhage (Nelson Elhage)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
```
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.



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