Bug after string refactoring
Andreas Raab
andreas.raab at gmx.de
Sun Apr 17 21:29:24 UTC 2005
Folks,
Apparently, I'm the only guy who runs the refactored string stuff ;-) Or
else I would have expected to get a few complaints over strange method
orderings in the browser. It looks like the string refactoring broke
comparison - where before we had:
'foo' < 'foo:' "true"
'foo:' < 'fooBar' "true"
we now have
'foo' < 'foo:' "true"
'foo:' < 'fooBar' "false"
which leads to ugly effects in the browser, e.g.,
foo
fooBar
fooBar:
foo:
It turns out that the culprit is String>>compare:caseSensitive: which says:
compare: aString caseSensitive: aBool
| map |
map := aBool
ifTrue:[CaseSensitiveOrder]
ifFalse:[CaseInsensitiveOrder].
^self compare: self with: aString collated: map
Turns out that CaseSensitiveOrder is not the same as AsciiOrder as I
expected. Clearly, this is wrong the way it is right now but looking at
it from before the string refactoring it makes me wonder what that
CaseSensitiveOrder was actually good for? It claims it sorts "space,
digits, letters, all the rest" but where is this actually used (e.g.,
which applications rely on this ordering)?
I'm trying to find this out so that I can fix these things properly.
Speedy feedback would be welcome, otherwise I'll propose to replace the
above with AsciiOrder and your ordering is moot ;-)
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|