Project

General

Profile

This project is closed and read-only.

Actions

Backport #1210

closed

Array behavior for minus/uniq is not as expected for hash elements

Backport #1210: Array behavior for minus/uniq is not as expected for hash elements

Added by HitsvilleUSA (Chris Morris) over 17 years ago. Updated about 7 years ago.


Description

=begin
Array#- does not remove an element of type hash (line 8):
irb(main):001:0> a = {}
=> {}
irb(main):002:0> b = {}
=> {}
irb(main):003:0> c = []
=> []
irb(main):004:0> a == b
=> true
irb(main):005:0> c << a
=> [{}]
irb(main):006:0> c.index(a)
=> 0
irb(main):007:0> c.index(b)
=> 0
irb(main):008:0> c - [b]
=> [{}]
irb(main):009:0> c - [a]
=> []

Array#uniq does not remove an element of type hash (line 7):
irb(main):001:0> a = {}
=> {}
irb(main):002:0> b = {}
=> {}
irb(main):003:0> c = []
=> []
irb(main):004:0> a == b
=> true
irb(main):005:0> c << a
=> [{}]
irb(main):006:0> c << b
=> [{}, {}]
irb(main):007:0> c.uniq
=> [{}, {}]
=end

Updated by m (m .) about 17 years ago Actions #1

=begin
Looks like both of these issues were fixed a while ago in ruby_1_8 and in ruby_1_9.

You might wanna close this ticket but Kirk Haines should be informed so he can backport it to 1.8.6 (in case it's not there yet).
=end

Updated by marcandre (Marc-Andre Lafortune) about 17 years ago Actions #2

=begin
Issues are still present in ruby 1.8.6 (2009-08-26 patchlevel 387) [i686-darwin10.0.0]
=end

Updated by marcandre (Marc-Andre Lafortune) almost 17 years ago Actions #3

  • Status changed from Open to Assigned
  • Assignee set to wyhaines (Kirk Haines)
  • Priority changed from Normal to 3

=begin

=end

Updated by jeremyevans0 (Jeremy Evans) about 7 years ago Actions #4

  • Project changed from 2 to 5
  • Description updated (diff)
  • Status changed from Assigned to Closed
Actions

Also available in: PDF Atom