On 10/16/06, Yukihiro Matsumoto <matz / ruby-lang.org> wrote:
> Hi,
>
> In message "Re: Symbol < String in Ruby > 1.8"
>     on Mon, 16 Oct 2006 11:31:43 +0900, "Rick DeNatale" <rick.denatale / gmail.com> writes:
>
> |In any event, this change SHOULD be less controversial than the fact
> |that as of the current 1.9, Strings are no longer enumerable!
> |
> |$ irb1.9
> |irb(main):001:0> "abc\ndef\n".sort
> |NoMethodError: undefined method `sort' for "abc\ndef\n":String
> |        from (irb):1:in `Kernel#binding'
>
> Yes, insert ".lines" if you need Enumerable methods, e.g.
>
>   "abc\ndef\n".lines.sort
>
> for above code.

I'm curious as to why it's a good thing to make String nonenumerable
and remove String#each instead of just aliasing lines to each?  Are
there drawbacks which make it worthwhile breaking existing code?

It's not that I'm against any incompatibility, as long as there's a rationale.

> |Also there's no :chars, or :each_char, although "abc"[0] now gives
> |"a" instead of 97.
>
> You will have chars and each_chars along with other M17N
> functionality.  I wanted merge it before RubyConf (to show Tim Bray
> working code), but regretfully failed. ;-<

Thanks,

I'm also curious as to whether or not and why you considered and
rejected introducing a Character class as part of the M17N support,
perhaps as a subclass of String, rather than just using
single-character strings.


-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/