[#99002] [Ruby master Feature#17004] Provide a way for methods to omit their return value — shyouhei@...

Issue #17004 has been reported by shyouhei (Shyouhei Urabe).

21 messages 2020/07/01

[#99044] [Ruby master Bug#17007] SystemStackError when using super inside Module included and lexically inside refinement — eregontp@...

Issue #17007 has been reported by Eregon (Benoit Daloze).

7 messages 2020/07/03

[#99078] [Ruby master Feature#17016] Enumerable#scan_left — finch.parker@...

Issue #17016 has been reported by parker (Parker Finch).

42 messages 2020/07/07

[#99079] [Ruby master Bug#17017] Range#max & Range#minmax incorrectly use Float end as max — bosticko@...

Issue #17017 has been reported by sambostock (Sam Bostock).

25 messages 2020/07/07

[#99097] [Ruby master Bug#17021] "arm64" and "arm" are mixed in RbConfig on Apple silicon — watson1978@...

Issue #17021 has been reported by watson1978 (Shizuo Fujita).

9 messages 2020/07/09

[#99115] [Ruby master Bug#17023] How to prevent String memory to be relocated in ruby-ffi — larskanis@...

Issue #17023 has been reported by larskanis (Lars Kanis).

22 messages 2020/07/10

[#99156] [Ruby master Bug#17030] Enumerable#grep{_v} should be optimized for Regexp — marcandre-ruby-core@...

Issue #17030 has been reported by marcandre (Marc-Andre Lafortune).

25 messages 2020/07/13

[#99257] [Ruby master Misc#17041] DevelopersMeeting20200826Japan — mame@...

Issue #17041 has been reported by mame (Yusuke Endoh).

18 messages 2020/07/22

[#99308] [Ruby master Feature#17047] Support parameters for MAIL FROM and RCPT TO — bugs.ruby-lang.org@...

Issue #17047 has been reported by c960657 (Christian Schmidt).

11 messages 2020/07/23

[#99311] [Ruby master Bug#17048] Calling initialize_copy on live modules leads to crashes — XrXr@...

Issue #17048 has been reported by alanwu (Alan Wu).

17 messages 2020/07/24

[#99351] [Ruby master Bug#17052] Ruby with LTO enabled on {aarch64, ppc64le} architectures. — v.ondruch@...

Issue #17052 has been reported by vo.x (Vit Ondruch).

35 messages 2020/07/27

[#99375] [Ruby master Feature#17055] Allow suppressing uninitialized instance variable and method redefined verbose mode warnings — merch-redmine@...

Issue #17055 has been reported by jeremyevans0 (Jeremy Evans).

29 messages 2020/07/28

[#99391] [Ruby master Feature#17059] epoll as IO.select — dsh0416@...

Issue #17059 has been reported by dsh0416 (Delton Ding).

18 messages 2020/07/29

[#99418] [Ruby master Feature#17097] `map_min`, `map_max` — sawadatsuyoshi@...

Issue #17097 has been reported by sawa (Tsuyoshi Sawada).

11 messages 2020/07/31

[ruby-core:99390] [Ruby master Bug#17058] Array#delete_if doesn't change array instantly

From: erik@...
Date: 2020-07-29 15:18:56 UTC
List: ruby-core #99390
Issue #17058 has been reported by erik_schlyter (Erik Schlyter).

----------------------------------------
Bug #17058: Array#delete_if doesn't change array instantly
https://bugs.ruby-lang.org/issues/17058

* Author: erik_schlyter (Erik Schlyter)
* Status: Open
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
According to the documentation: https://ruby-doc.org/core-2.7.1/Array.html#method-i-delete_if
"The array is changed instantly every time the block is called, not after the iteration is over."

I've tried printing the array while iterating it:
```
a = [1,2,3,4,5,6,7]
a.delete_if{|x|
  puts "During iteration: #{a}"
  x % 2 == 0
}
puts "After iteration: #{a}"
```

The output is as follows:
```
During iteration: [1, 2, 3, 4, 5, 6, 7]
During iteration: [1, 2, 3, 4, 5, 6, 7]
During iteration: [1, 2, 3, 4, 5, 6, 7]
During iteration: [1, 3, 3, 4, 5, 6, 7]
During iteration: [1, 3, 3, 4, 5, 6, 7]
During iteration: [1, 3, 5, 4, 5, 6, 7]
During iteration: [1, 3, 5, 4, 5, 6, 7]
After iteration: [1, 3, 5, 7]
```

This functionality has changed somewhere between 2.2.2 and 2.4.0. When I use "ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]", I get the following (correct) output:
```
During iteration: [1, 2, 3, 4, 5, 6, 7]
During iteration: [1, 2, 3, 4, 5, 6, 7]
During iteration: [1, 3, 4, 5, 6, 7]
During iteration: [1, 3, 4, 5, 6, 7]
During iteration: [1, 3, 5, 6, 7]
During iteration: [1, 3, 5, 6, 7]
During iteration: [1, 3, 5, 7]
After iteration: [1, 3, 5, 7]

```
When I use "ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]" or the latest (2.7.1), I get the wrong output.


The functionality doesn't seem crucial, but the documentation should be correct.



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

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next