[#92891] Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1? — Al Snow <jasnow@...>
Tried the new 2.7.0-preview1 upgrade to Ruby and see that bundler is also upgraded (to 2.1.0.pre.1).
5 messages
2019/05/30
[#92892] Re: Question: ruby 2.7.0-preview1 also upgrades bundler to 2.1.0.pre.1?
— SHIBATA Hiroshi <hsbt@...>
2019/05/30
Bundler 2.1.0.pree.1 is the expected version.
[ruby-core:92563] [Ruby trunk Bug#15830] SortedSet's lazy setup causes unpredictable behaviour in subclass's initialize
From:
viko@...
Date:
2019-05-05 20:11:41 UTC
List:
ruby-core #92563
Issue #15830 has been reported by viko (Viko Viko).
----------------------------------------
Bug #15830: SortedSet's lazy setup causes unpredictable behaviour in subclass's initialize
https://bugs.ruby-lang.org/issues/15830
* Author: viko (Viko Viko)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
``` ruby
require 'set'
class SortedSetWithoutLowest < SortedSet
def initialize contents=[]
puts "initialize, #{contents}"
super
lowest = to_a[0]
puts "lowest from #{contents} is #{lowest}, removing"
delete lowest
puts "done initializing #{contents} to #{self}"
end
end
3.times { SortedSetWithoutLowest[1,2,3,4,5] }
```
```
initialize, [1, 2, 3, 4, 5]
initialize, [1, 2, 3, 4, 5]
lowest from [1, 2, 3, 4, 5] is 1, removing
done initializing [1, 2, 3, 4, 5] to #<SortedSetWithoutLowest: {2, 3, 4, 5}>
lowest from [1, 2, 3, 4, 5] is 2, removing
done initializing [1, 2, 3, 4, 5] to #<SortedSetWithoutLowest: {3, 4, 5}>
initialize, [1, 2, 3, 4, 5]
lowest from [1, 2, 3, 4, 5] is 1, removing
done initializing [1, 2, 3, 4, 5] to #<SortedSetWithoutLowest: {2, 3, 4, 5}>
initialize, [1, 2, 3, 4, 5]
lowest from [1, 2, 3, 4, 5] is 1, removing
done initializing [1, 2, 3, 4, 5] to #<SortedSetWithoutLowest: {2, 3, 4, 5}>
```
The first such set created ends up with only [3, 4, 5], because SortedSet does some setup and then re-calls initialize (`set.rb` line 807). All further such sets are fine. All the sets are fine if any SortedSet has been made before, so calling `SortedSet.new` in the subclass's `initialize` and discarding the result is a viable workaround.
--
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>