Issue #13593 has been updated by naruse (Yui NARUSE).


We discussed about this in developer meeting.
This feature has some difficulty in spec for example padding, unknown type (other than AF_INET, AF_INET6, AF_UNIX, and so on), which should it use for the comparison.
Though such difficulty, we can define a spec only for AF_INET and AF_INET6 if there's concrete use case.

----------------------------------------
Bug #13593: Addrinfo#== behaves oddly
https://bugs.ruby-lang.org/issues/13593#change-81586

* Author: ioquatix (Samuel Williams)
* Status: Rejected
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
It appears as if Addrinfo is using object identity. `Addrinfo#==` doesn't appear to work as one might expect, given the same instantiation:

~~~
> irb
2.4.0 :001 > require 'socket'
 => true 
2.4.0 :002 > Addrinfo.tcp('0.0.0.0', 1234) == Addrinfo.tcp('0.0.0.0', 1234)
 => false 
2.4.0 :003 > a = Addrinfo.tcp('0.0.0.0', 1234)
 => #<Addrinfo: 0.0.0.0:1234 TCP> 
2.4.0 :004 > a == a
 => true 
2.4.0 :005 > 
~~~



---Files--------------------------------
addrinfo_eql.diff (575 Bytes)


-- 
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>