On 10/19/06, Mauricio Fernandez <mfp / acm.org> wrote:

> What about:
> * defining String#to_enum, which would accept an argument (:lines, :chars or
>   :bytes) defaulting to :lines. Note that right now (in HEAD) "foo".to_enum
>   ends up using Kernel#to_enum, raising a NameError (undefined #each for class
>   String).
> * making  str.lines (chars, bytes) equivalent to
>   str.to_enum(:lines).to_a  (respectively :chars, :bytes)
> ?

I really don't like all this "explicit" casting that's going on.
Str.lines looks pretty and simple.  Str.to_enum(:lines) looks
complicated and even sort of hackish.  I read the to_enum like a
type-cast more than a method call here.  And sure, that's sort of
what's happening, but with str.lines it looks a lot more like I"m
asking str for something instead of me brutally forming it into
something else as is the case with str.to_enum.  Using X#to_Y is fine
for doing duck-typing, but I don't think this is what we're doing
here.

  nikolai