From: Martin DeMello Date: 2005-08-08T16:41:09+09:00 Subject: Re: String#to_ary and Test::Unit Yukihiro Matsumoto wrote: > > I don't think providing to_ary for objects which are not really > arrays. In this case, puts recurse for objects with to_ary, then each > array returned from to_ary contains objects with to_ary (strings), > then infinite recursion. I'd go further, and say that String should not implement Enumerable - as it is, any code that wants to recursively traverse collections has to include a check for String so that it doesn't get into the infinite "String is a collection of Strings" recursion. each_byte, each_word and each_line (without any default 'each') should provide most of the functionality people need anyway - I can't remember ever needing to call map or inject on a String unless I'd already #split or #scanned it into an Array first. martin