No-argument sort() is a no-op on strings - bug?
-
A no-argument (not passing a comparator function) call to
sort()on strings in an unexpected no-op.Seems like a bug?
Docs: https://docs.hise.dev/scripting/scripting-api/array/index.html#sort

const var n = [3, 1, 2]; const var s = ["b", "c", "a"]; Console.print(trace(n.sort())); // ✅ [3, 1, 2] becomes [1, 2, 3] Console.print(trace(s.sort())); // ❌ stays ["b", "c", "a"] Console.print(trace(s.sortNatural())); // ✅ properly sorted as ["a", "b", "c"]sortNatural()is the function that works for sorting strings. -
@dannytaurus I made a video about sorting and I hadn't even noticed the docs are wrong.
-
@David-Healey So you think the docs are wrong, rather than it being a bug?
If it's intentional behaviour I won't file a fix. But if it's a bug, it should get fixed because it's one of those silent time-wasters that can grind productivity to a halt.
-
@dannytaurus said in No-argument sort() is a no-op on strings - bug?:
So you think the docs are wrong, rather than it being a bug?
Could be either