From: Yukihiro Matsumoto Date: 2008-11-03T22:59:31+09:00 Subject: [ruby-core:19682] Re: Odd TypeError in inject (1.9.1 preview 1) Hi, In message "Re: [ruby-core:19660] Odd TypeError in inject (1.9.1 preview 1)" on Fri, 31 Oct 2008 20:20:56 +0900, "David A. Black" writes: |I think this should return 0. Anything I'm missing? | |>> RUBY_DESCRIPTION |=> "ruby 1.9.1 (2008-10-28 revision 19983) [i386-darwin9.5.0]" |>> [].inject(0) |TypeError: 0 is not a symbol | from (irb):4:in `inject' | from (irb):4 | from /usr/local/bin/irb19:12:in `
' According to [ruby-core:19666], you expect [].inject(0) to work as obj.enum_for(:inject, other_object) right? But the current behavior of enumerator only works right for iterators that do not use the values from blocks. e.g. #each. So, enumerators do not work for #inject (and #map). So expecting something do not work is kinda weird. matz.