[#100689] [Ruby master Feature#17303] Make webrick to bundled gems or remove from stdlib — hsbt@...
Issue #17303 has been reported by hsbt (Hiroshi SHIBATA).
11 messages
2020/11/02
[#100852] [Ruby master Feature#17326] Add Kernel#must! to the standard library — zimmerman.jake@...
SXNzdWUgIzE3MzI2IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGpleiAoSmFrZSBaaW1tZXJtYW4pLg0K
24 messages
2020/11/14
[#100930] [Ruby master Feature#17333] Enumerable#many? — masafumi.o1988@...
Issue #17333 has been reported by okuramasafumi (Masafumi OKURA).
10 messages
2020/11/18
[#101071] [Ruby master Feature#17342] Hash#fetch_set — hunter_spawn@...
Issue #17342 has been reported by MaxLap (Maxime Lapointe).
26 messages
2020/11/25
[ruby-core:100900] [Ruby master Bug#17197] Some Hash methods still have arity 2 instead of 1
From:
mame@...
Date:
2020-11-17 14:24:19 UTC
List:
ruby-core #100900
Issue #17197 has been updated by mame (Yusuke Endoh).
Ah, I was wrong.
mame (Yusuke Endoh) wrote in #note-6:
> IMO, this is a bug since 1.9.0 because Hash#select looks like a faster version of Enumerable#select, so it should behave as possible as like Enumerable#select.
Hash#select returns a hash instead of an array, so Hash#select is not a simple faster variant of Enumerable#select. So it don't necessarily have to follow the arity.
Just for the record: I found one affected use case of `Hash#select` with one-arity block in [a popular gem](https://rubygems.org/gems/docker-api):
https://github.com/swipely/docker-api/blob/1e9b9cc5f0f38dcd54c18189812328bb802d3656/lib/docker/container.rb#L327
```
def self.create(opts = {}, conn = Docker.connection)
query = opts.select {|key| ['name', :name].include?(key) }
```
It is very difficult to find this kind of cases by gem-codesearch, so I guess there are more cases.
----------------------------------------
Bug #17197: Some Hash methods still have arity 2 instead of 1
https://bugs.ruby-lang.org/issues/17197#change-88552
* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* ruby -v: ruby 3.0.0dev (2020-09-26T17:38:39Z master 950614b088)
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
`Hash#each` was changed recently to have arity of 1.
All other methods of `Hash` should behave the same.
Much has been fixed since #14015, but some remains:
```ruby
# Some methods consistently have arity 2:
{a: 1}.select( &->(_kvp) {} ) # => ArgumentError (wrong number of arguments (given 2, expected 1))
```
All in all: `%i[select keep_if delete_if reject to_h]` have their arity still set at 2.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>