On 2/7/07, Ola Bini <ola.bini / ki.se> wrote:
> Nikolai Weibull wrote:
> > On 2/7/07, David Flanagan <david / davidflanagan.com> wrote:
> > Well, yes, that would make some sense.  But as I see it a
> > codepoint/character would have to have an encoding and we seem to be
> > leaving the realm of Fixnums again.  I was most probably mistaken
> > about the subclassing of Fixnum...
>
> Why should a codepoint/character have an encoding? That doesn't make
> sense. Of course, it would be nice to know what space the codepoint
> points into (Unicode or something else), but regardless of encoding a
> Unicode codepoint should be equal to the same codepaint, even if that
> character came from a string with a difference Unicode encoding.

What I meant was that if we're entering a realm where String#[] would
return something other than a String or a Fixnum, for example this yet
to be designed Codepoint class, then it would more than nice to know
to where it points.  Perhaps Character would make more sense then, but
the problem still remains that not all Characters were created equal
(that is, the Unicode character space is a lot different from that of
Shift-JIS).

Still, this is probably just confusing matters unnecessarily.
"a".alpha? is better than "a"[0].alpha?, I think.  String#alpha? is a
method that could work for Strings of any length as well, so I really
think it makes a lot of sense to overload String for basically all
character data.

  nikolai