Bugs item #9661, was opened at 2007-03-29 00:56 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9661&group_id=426 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Charles Nutter (headius) Assigned to: Nobody (None) Summary: String#[] does not use result of to_int Initial Comment: This seems like a bug... class Foo def to_int 3 end end x = Foo.new p x.object_id y = "hello" y[x] = "t" ...prints out... 76260 test.rb:10:in `[]=': index 76260 out of string (IndexError) from test.rb:10 So it appears that even though to_int is defined on my Foo class, aref tries to use the object ID to index into the string. It should use the result of to_int, no? ---------------------------------------------------------------------- >Comment By: Charles Nutter (headius) Date: 2007-03-29 00:58 Message: This is potentially related to issue #7202. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=1698&aid=9661&group_id=426