Stateless comparator that naively use to_s to compare things.

Note: the result of to_s is not cached, thus can be invoked a lot on a single instace. See CachedAlphaComparator as an alternative.

var a = [1, 2, 3, 10, 20]
alpha_comparator.sort(a)
assert a == [1, 10, 2, 20, 3]

Property definitions

core :: abstract_text $ Sys :: alpha_comparator
# Stateless comparator that naively use `to_s` to compare things.
#
# Note: the result of `to_s` is not cached, thus can be invoked a lot
# on a single instace. See `CachedAlphaComparator` as an alternative.
#
# ~~~
# var a = [1, 2, 3, 10, 20]
# alpha_comparator.sort(a)
# assert a == [1, 10, 2, 20, 3]
# ~~~
fun alpha_comparator: Comparator do return once new AlphaComparator
lib/core/text/abstract_text.nit:2507,1--2517,67