From: SourceForge.net <no...@so...> - 2007-06-03 23:43:09
|
Bugs item #1730358, was opened at 2007-06-03 15:52 Message generated for change (Comment added) made by bigrixx You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684730&aid=1730358&group_id=119701 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Classes Group: 3.2.0 >Status: Closed >Resolution: Invalid Priority: 5 Private: No Submitted By: Rony G. Flatscher (orexx) Assigned to: Nobody/Anonymous (nobody) Summary: Same method object does not yield equal with = or == Initial Comment: Retrieving the same method object from the .Object class, one time with 'isA' and one time with 'isInstanceOf' and then comparing the two references (which create the same hash value if sending '==' to them) does not yield .true. Testing for unequality wrongly returns .false. Here is a test program: ------------ cut here ----------- m1=.object~method("isA") m2=.object~method("isInstanceOf") say "m1 :" m1~string '@' m1~"=="~c2x say "m2 :" m2~string '@' m2~"=="~c2x say say "m1=m2 :" (m1=m2) say "m1==m2 :" (m1==m2) say say "m1<>m2 :" (m1<>m2) say "m1><m2 :" (m1><m2) say say "m1\=m2 :" (m1\=m2) say "m1\==m2:" (m1\==m2) say say "-------" say "now using the method's hash values:" say say "m1~'==' = m2~'==' :" (m1~'==' = m2~'==') say "m1~'==' == m2~'==' :" (m1~'==' == m2~'==') say say "m1~'==' <> m2~'==' :" (m1~'==' <> m2~'==') say "m1~'==' >< m2~'==' :" (m1~'==' >< m2~'==') say say "m1~'==' \= m2~'==' :" (m1~'==' \= m2~'==') say "m1~'==' \== m2~'==' :" (m1~'==' \== m2~'==') ------------ cut here ----------- Running the program under ------------ cut here ----------- m1 : a Method @ 19000104 m2 : a Method @ 19000104 m1=m2 : 0 m1==m2 : 0 m1<>m2 : 1 m1><m2 : 1 m1\=m2 : 1 m1\==m2: 1 ------- now using the method's hash values: m1~'==' = m2~'==' : 1 m1~'==' == m2~'==' : 1 m1~'==' <> m2~'==' : 0 m1~'==' >< m2~'==' : 0 m1~'==' \= m2~'==' : 0 m1~'==' \== m2~'==' : 0 ------------ cut here ----------- ---------------------------------------------------------------------- >Comment By: Rick McGuire (bigrixx) Date: 2007-06-03 19:43 Message: Logged In: YES user_id=1125291 Originator: NO These are not the same method object, so they should not be expected to compare equal. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=684730&aid=1730358&group_id=119701 |