On the client side, ‘equal?’ does not compare objects structurally as is the case on the server side:
--8<---------------cut here---------------start------------->8--- function sc_isEqual(o1, o2) { return ((o1 === o2) || (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || (sc_isVector(o1) && sc_isVector(o2) && sc_isVectorEqual(o1, o2, sc_isEqual))); } --8<---------------cut here---------------end--------------->8--- The problem is that: --8<---------------cut here---------------start------------->8--- new Object({a: 3}) === new Object({a: 3}) ⇒ false --8<---------------cut here---------------end--------------->8--- Thus, two instances that are ‘equal?’ on the server side are not ‘equal?’ on the client side. I was considering changing ‘scm_isEqual’ along these lines:
diff -r d5c1b8a88937 scheme2js/runtime/immutable.js --- a/scheme2js/runtime/immutable.js Tue Sep 10 10:59:36 2013 +0200 +++ b/scheme2js/runtime/immutable.js Thu Sep 12 17:54:31 2013 +0200 @@ -84,7 +84,8 @@ (sc_isPair(o1) && sc_isPair(o2) && sc_isPairEqual(o1, o2, sc_isEqual)) || (sc_isVector(o1) && sc_isVector(o2) - && sc_isVectorEqual(o1, o2, sc_isEqual))); + && sc_isVectorEqual(o1, o2, sc_isEqual)) || + (hop_obj_to_string(o1) === hop_obj_to_string(o2))); } /*** META ((export number->symbol integer->symbol) (arity -2)) */
but this doesn’t work due to the fact that ‘hop_obj_to_string’ is non-deterministic. WDYT? Thanks, Ludo’.