2014-07-02 5:29 GMT+02:00 Jim Rees <jimree...@gmail.com>:

> Java has StringBuffer, Python has StringIO, R7RS has open-output-string.
>  Add seek support to ports in general and there you have it.    This gives
> implementors more flexibility as to speed/space trade-offs rather than make
> the string type all things to all people.   Just my thoughts...
>


Java is broken. From the Java 7 documentation:

"A String represents a string in the UTF-16 format in which *supplementary
characters* are represented by *surrogate pairs*. Index values refer to char
code units, so a supplementary character uses two positions in a String."

If you call Java to return you the third character, you will either get the
half of a surrogate pair or a completely different character or the
operation is is not O(1).

Sascha
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports

Reply via email to