[#92070] [Ruby trunk Feature#15667] Introduce malloc_trim(0) in full gc cycles — sam.saffron@...
Issue #15667 has been updated by sam.saffron (Sam Saffron).
3 messages
2019/04/01
[ruby-core:92213] [Ruby trunk Bug#15708] Implicit numbered argument decomposes an array
From:
sholde4@...
Date:
2019-04-08 19:31:17 UTC
List:
ruby-core #92213
Issue #15708 has been updated by sholden (Scott Holden).
Eregon (Benoit Daloze) wrote:
> FWIW, I would bet >99% of Rubyists would agree this is a bug: https://twitter.com/eregontp/status/1115318993299083265
This is definitely not the behavior I would expect. In everything that I've seen, developers are describing the feature such that
``` ruby
a.map{|x| x} == a.map{ @1 }
```
This would be a very surprising behavior for people to stumble upon.
----------------------------------------
Bug #15708: Implicit numbered argument decomposes an array
https://bugs.ruby-lang.org/issues/15708#change-77548
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.7.0dev
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
In the following, `@1` refers to the entire item iterated:
```ruby
a = [1, 2, 3]
a.map{|x| x} # => [1, 2, 3]
a.map{@1} # => [1, 2, 3]
```
whereas in the following, `@1` refers to the first item achieved by decomposing the item iterated, behaving the same as `x` given by `|(x)|` rather than by `|x|`:
```ruby
a = [[1], [2], [3]]
a.map{|x| x} # => [[1], [2], [3]]
a.map{|(x)| x} # => [1, 2, 3]
a.map{@1} # => [1, 2, 3]
```
Is this intended?
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>