From: Aaron Patterson Date: 2012-05-07T08:20:23+09:00 Subject: [ruby-core:44915] Re: [ruby-trunk - Bug #6408] DelegateClass#eql? and <=> don't work as expected --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 07, 2012 at 07:15:34AM +0900, marcandre (Marc-Andre Lafortune) = wrote: >=20 > Issue #6408 has been updated by marcandre (Marc-Andre Lafortune). >=20 >=20 > Hi, >=20 > In your patch, for both `if obj.equal? self`, shouldn't it be `if obj.is_= a? Delegator`? >=20 > For many classes that define their comparison operators, this might not b= e sufficient if you want comparison operators to work well, as they typical= ly will first check on the class of the object to compare with. >=20 > Defining `is_a?` to return true for either Delegator or the class delegat= ed to might be more helpful. I was thinking that too, but the current implementation of !=3D and =3D=3D don't do the is_a? check. Maybe those should be changed? Anyway, I don't know about other changes, but the failing tests I have in this patch are causing issues for some rails users: https://github.com/rails/rails/issues/5974 I feel like we probably need better tests surrounding the "correct" behavior of DelegateClass, but I'd rather not shave that yak at the moment and just fix the issues we're having today. :) --=20 Aaron Patterson http://tenderlovemaking.com/ --17pEHd4RhPHOinZp Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) iQEcBAEBAgAGBQJPpwc2AAoJEJUxcLy0/6/GRgMIAKKL0Qb6uvAdHb0AM+rxk81O 3Zw4XV8H63Abwcdoa5vIEZeHvhCnaUEi9TjsJyUDOS5YLZFjidTiTb9BMnbtEToR q89ZGlg+pEi9OMFrxgl0kAcPiUHFPfyW+GAY/NRNSlmIRzmkBrFU3qMpqixvdJ1u YZxglDnHxyFIbYgjQYuc0gt/vnSP6SJcB9Knp1gZXLU8hXJe90s/Cf2AFHa6iSa8 cAd3zOm5yNc5bY7t+xiUojBq1beVmUuO2c9pv3d929NBNfqCo7Vb8dob+UiPfQp9 YnVuVZy/MQcKovRxeocXqbNnwnnMBVTIElriAE4FNnr3szrjMqJE/iSG6A+sbZ8= =Rqs3 -----END PGP SIGNATURE----- --17pEHd4RhPHOinZp--