Devin Mullins <twifkak / comcast.net> wrote:

>>> 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. (See any discussion on  
> Unicode, etc. in Ruby.)

What about Regular Expressions?

   str = "ไข
   str.scan(/./).length   #=> 2
   $KCODE = 'u'
   str.scan(/./).length   #=> 1

> 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.

The possibilities would be:

   (a)
     str = "foo"
     c = str.shift    #=> 102
     c.class          #=> Fixnum
     str              #=> "oo"

   (b)
     str = "foo"
     c = str.shift    #=> "f"
     c.class          #=> String
     str              #=> "oo"

   (c)
     # make String#shift act like split(/./).shift

(a) would probably most consistent.

-Levin