5 Jun
2014
5 Jun
'14
12:57 a.m.
Glenn Linderman wrote:
so algorithms that walk two strings at a time cannot use the same StringPosition to do so... yep, this is quite divergent from CPython and Python.
They can, it's just that at most one of the indexing operations would be fast; the StringPosition would devolve into an int for the other one. Such an algorithm would be of dubious correctness anyway, since as you pointed out, codepoints and characters are not quite the same thing. A codepoint index in one string doesn't necessarily count off the same number of characters in another string. So to be safe, you should really walk each string individually. -- Greg