On Sat, 23 May 2009 10:20:50 +0900 Yukihiro Matsumoto <matz / ruby-lang.org> wrote: > Hi, > > In message "Re: [ruby-core:23499] [Bug #1487] String#each_char must > return self" on Tue, 19 May 2009 14:27:54 +0900, Marc-Andre Lafortune > <redmine / ruby-lang.org> writes: > > |str.each_char{} currently returns a copy of str. It should return > self. This also affects Ruby 1.8.7 > > Before accepting the proposal, could you explain why we _should_ > return the original string? We haven't defined the return value of > each_char yet. > > matz. string = 'foo' string.object_id == string.each_codepoint{|x|}.object_id # => true string.object_id == string.each_byte{|x|}.object_id # => true string.object_id == string.each_line{|x|}.object_id # => true string.object_id == string.each_char{|x|}.object_id # => false I was hoping for a little bit of consistency as well. -- ^ manveru