Menu

#55 NSStrings can't be used for hash-keys

closed
5
2009-09-23
2009-09-03
No

Because NSString don't implement method "hash", see documentation for Object#hash and Hash (http://apidock.com/ruby/Object/hash and http://apidock.com/ruby/Hash\).
I've provided an example that show's the problem both with hash-objects and when using uniq-method in an array containing NSStrings.

This isn't how regular Ruby-strings work at least.

Discussion

  • Johan Lundström

    Example

     
  • Johan Lundström

    • labels: --> unexpected behavior
     
  • kimura wataru

    kimura wataru - 2009-09-23
    • assigned_to: nobody --> kimuraw
    • status: open --> closed
     
  • kimura wataru

    kimura wataru - 2009-09-23

    I fixed this problem at trunk r2263.
    http://rubycocoa.svn.sourceforge.net/viewvc/rubycocoa?view=rev&revision=2263

    you can use this code before next RubyCocoa release

    ----
    module OSX
    class NSString
    def hash
    oc_hash
    end
    end
    end
    ------

     

Log in to post a comment.