[Mono-list] CharEnumerator and String

Duco Fijma duco@lorentz.xs4all.nl
03 Mar 2002 23:40:02 +0100


I just completed a few test cases for the System.CharEnumerator class.
The many failures these test cases generate are caused not so much by
the CharEnumerator class itself, but by the current state of the
System.String class. This made me wonder what the plans are with the
String class. Is anybody planning to give this class the attention it
needs? I remember a message of Paolo some time ago even talking about
completely replacing the class. Does this mean that any effort put into
fixing the current code is useless?

(Just is case: this is definitely not meant as negative criticism to
anybody, I'm just interested in who's having what plans with an
important basic class such as System.String)

By the way: while the CharEnumerator tests are not very useful at this
moment, I think I spotted a bug in the class: when reading beyond the
end of the string iterated, this fact is flagged by setting the member
variable idx, which keeps the state of the iterator, to -2. This
"special value", however, is not recognized by the "Current" property.
The getter of this property throws an exception only when idx==-1. I
think it should throw one in the case idx=-2, too.

I felt a bit reluctant fixing this supposed bug, as I'm not really able
to test it. Anyway, this case should also be covered by my test, so
sooner or later, we will (re)run into it...