Bug 44641


GemStone/S 64 Bit

3.4, 3.3.5, 3.3.4, 3.3.3, 3.3.1, 3.3, 3.2.16, 3.2.15, 3.2.14, 3.2.13, 3.2.12, 3.2.11, 3.2.10, 3.2.9,, 3.2.8, 3.2.7, 3.2.6, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2,,,,,,, 3.1, 3.0.1, 3.0, 2.4.8, 2.4.7, 2.4.6,, 2.4.5,,,,,,, 2.4.x, 2.4,, 2.3.x, 2.3,, 2.2.x, 2.x, 1.x

Inconsistent behavior in comparisons of Strings and Symbols with same contents

When a String and a Symbol have the same contents, equality and less/greater than return false, while less/greater than or equal returns true.  Since intuitively, less/greater than or equal imples that either one or the other of less/greater than and equal is true, this is inconsistent.

'abc' = #abc --returns false
'abc' < #abc  --returns false
'abc' <= #abc  --returns true

VisualWorks and VA Smalltalk also have this behavior; to avoid perturbing existing code, GemTalk does not intend to change the behavior.


Avoid comparisons that mix Strings and Symbols.  If you must perform comparisons that mix instances of different classes and perform comparisons and include elements with identical contents, carefully consider the operator you use to ensure that the results are what you intend.

Mixing Strings and Symbols with identical contents in a SortedCollection with a default SortBlock, which uses <=, will not be ordered deterministically; the ordering will depend on the order elements are added.

Last updated: 11/13/14