Devin Mullins <twifkak / comcast.net> writes:

> Daniel Brockman wrote:
>
>> Whatever String#[] and all the other String methods index, of course.
>
> Depending on the parameter you pass, #[] can return a String or an
> an Integer.

Correct.

>>> There is no clear notion of an "Element" in a String.
>>
>> If this is true, then we have a serious problem.  Before doing much
>> anything about its API, we need to decide whether String is a byte
>> array or a character array.  (Presumably, matz & co. already have.)
>
> There's no such thing as a character in Ruby.

Not currently, no.

> (See any discussion on Unicode, etc. in Ruby.)

Indeed, you have managed to poke my interest, and I'm going to look
into this further.

> Strings are Objects (stored in C as char*s, I'd guess).

Obviously.

> Call the right methods on them, and you can get an Integer
> representing the byte value at a given position ("Hello"[0]),

Yes, but is this subject to change?  If so, I guess String is destined
to become a character array.  If not, a byte array.

> or another String object representing some manipulation of the
> String ("Hello"[0..0]).

I'm not talking about subranges.

> Those are your only means of inspection.  That was just a
> long-winded way of saying "this is true."
>
> Anything I didn't reply to, I probably agree with. Since the String
> methods don't have a consistent notion of an "element," it doesn't
> seem it would hurt to choose whichever notion we want for a
> potential #shift method.

No, it does not.  If the semantics of String are normalized in a
future version, the issue of String#shift will be one among many.

-- 
Daniel Brockman <daniel / brockman.se>

    So really, we all have to ask ourselves:
    Am I waiting for RMS to do this?   --TTN.