Generalize the explanation of the side effect of the rb_equal() optimization
This commit is contained in:
parent
48d509cefc
commit
e79e5e0b40
6
object.c
6
object.c
@ -154,8 +154,10 @@ case_equal(VALUE obj1, VALUE obj2) {
|
|||||||
* identity check using using C's == (same as BasicObject#equal?).
|
* identity check using using C's == (same as BasicObject#equal?).
|
||||||
* If that check fails, it calls #== dynamically.
|
* If that check fails, it calls #== dynamically.
|
||||||
* This optimization actually affects semantics,
|
* This optimization actually affects semantics,
|
||||||
* as Float::NAN == Float::NAN is false,
|
* because when #== returns false for the same object obj,
|
||||||
* but rb_equal(Float::NAN, Float::NAN) is true!
|
* rb_equal(obj, obj) would still return true.
|
||||||
|
* This happens for Float::NAN, where Float::NAN == Float::NAN
|
||||||
|
* is false, but rb_equal(Float::NAN, Float::NAN) is true.
|
||||||
*/
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
rb_equal(VALUE obj1, VALUE obj2)
|
rb_equal(VALUE obj1, VALUE obj2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user