James Gray wrote:
> On Feb 24, 2009, at 8:47 AM, Brian Candler wrote:
> 
>> IMO, the underlying problems are that ruby 1.9's concept of Strings is
>> (a) not properly thought-out
> 
> This seems pretty silly.  It took years to develop.  You really
> believe they didn't consider what they were doing in that time?

Possibly they were so wrapped up in it that they didn't step back and 
look at the end product.

ri19 describes a String like this:

     A +String+ object holds and manipulates an arbitrary sequence of
     bytes, typically representing characters. String objects may be
     created using +String::new+ or as literals.

That makes sense, and actually this description is unchanged from 1.8.

When you manipulate them, they don't *behave* at all like sequences of 
bytes, and this is intentional: they are intended to behave like 
sequences of characters. But in an attempt to DTRT in all situations, 
they behave in strange and unpredictable ways. By that I mean: *I* can't 
predict how simple expressions like "#{a}" or /#{a}/ will work (in terms 
of encodings) without actually trying them. And if I want to read binary 
data from STDIN, I have to jump through hoops to ensure it's not tainted 
with the wrong encoding.
-- 
Posted via http://www.ruby-forum.com/.