Runtime/Behavior Changes

In 11.0, all built in string type (str) comparison methods have been changed to be locale-independent to ensure deterministic behavior. This includes compare(), icompare(), gt(), lt(), ge(), le(), sort(), isort(), >, >=, <, <=, and sorted maps with str key types.

In previous versions, certain low level drivers were overriding the global locale which resulted in unpredictable behaviors with CET, usually manifesting in issues with displaying the correct $RS value or crashes in worst cases. This change means that the C locale environment variable (LC_ALL) will now be ignored.

What are the effects?

In practical scenarios, this should not affect general behavior such as sorting or localization, as CM has been using the default LC_ALL=C locale, and most UI in CET should be handled transparently with our localization wrappers. However, testing should still be done to ensure there are no undesirable side effects.

How to check if I have any code that is affected?

We have provided a detector for any such methods that may be affected by the changes above. Simply run the code below, and evaluate if each warning need to be fixed (see next sections).

{
  enableLocaleStrCompareWarnings(enable=true, warnings=true);
  cm.runtime.util.qmegaCAB("custom.extensionName");
}

How do I fix the warnings or revert to the old behavior?

We have also provided versions of the methods above, prefixed with lc_, which will behave the same as older versions of CM, including lc_compare(), lc_icompare(), lc_gt(), lc_lt(), lc_ge(), lc_le(), lc_sort(), lc_isort(). These methods would respect the C Locale, however we would recommend to only use them if you are sure you need to.

For sorted maps, you can fix by setting a custom compare function:

{
    sorted str->int test = ["dd"->3, "ee"->4];
    test.setCompare(function lc_compare3);

    public int lc_compare3(str a, str b, Object env) { return lc_compare(a, b); }
}

How to silence (ignore) the warnings?

Simply add // !lc to the end of the line of code.