[ruby-talk:02576] Re: String.succ

From: matz@... (Yukihiro Matsumoto)
Date: 2000-04-26 06:51:53 UTC
List: ruby-talk #2576
Hi,

In message "[ruby-talk:02575] String.succ"
    on 00/04/26, Dave Thomas <Dave@thomases.com> writes:

|Should
|
|   "\377".succ  # -> "\000"
|
|I _think_ I'd expect "\001\000".
|
|Similarly, "".succ returns "\377", because it uses a carry that was
|never set.
|
|In reality, these are pathological, so I wouldn't call them
|bugs. However, I'm wondering how to document them.

Ok, I define as following:

  "".succ == ""
  "\377".succ == "\001\000"

I'll submit a patch in few days.  Magic increment for binary strings
are done only if they contain no alpha numeric character.

							matz.

In This Thread