Menu

#186 Please add a clarification to the '==' method in 'Object'

Next_Release
closed
5
2012-08-14
2007-06-07
No

The current documentation for the Object's "==" method without an argument states (e.g. http://www.oorexx.org/rexxref/x9980.htm#COO):

"Returns 1 (true) or 0 (false), the result of performing a specified comparison operation. If you specify the == operator and omit argument, a string representation is returned representing a hash value for Set, Bag, Table, Relation, and Directory."

Suggested addition at the end of this paragraph to clarify that that hash value cannot be used to determine the identity of an object:

---------- cut here ---------
Please note: different objects may generate the same hash value occasionally, therefore this value cannot be regarded to be a "unique identifier".
---------- cut here ---------

Discussion

  • Rick McGuire

    Rick McGuire - 2007-06-07

    Logged In: YES
    user_id=1125291
    Originator: NO

    I strongly disagree with this wording. Different objects will generate the same hash value more than just "occasionally". It is frequently a requirement that they generate the same has value. Consider the following sequence:

    a = "abc"
    b = "ab"||"c"

    the variables "A" and "B" point to different instances of the string class, each with the internal value "abc". These two instances must return the same value for their hashes otherwise hash table lookups using these two strings would not succeed.

     
  • Rony G. Flatscher

    Logged In: YES
    user_id=662126
    Originator: YES

    Agreed, how about:

    --------- cut here ---------
    Please note: it is very likely that different objects will generate the same hash value, therefore this value cannot be regarded to be a "unique identifier".
    ---------- cut here ---------

     
  • Rick McGuire

    Rick McGuire - 2007-06-07

    Logged In: YES
    user_id=1125291
    Originator: NO

    I'd leave off the probability bit. Remove the word "occasionally" from your original wording, and I'm fine with it.

     
  • Rony G. Flatscher

    Logged In: YES
    user_id=662126
    Originator: YES

    O.K., then this would be it:

    ---------- cut here ---------
    Please note: different objects may generate the same hash value, therefore this value cannot be regarded to be a "unique identifier".
    ---------- cut here ---------

     
  • David Ashley

    David Ashley - 2007-06-08

    Logged In: YES
    user_id=931756
    Originator: NO

    Fixed in revision 440.

     

Anonymous
Anonymous

Add attachments
Cancel