One other wrinkle more in line with this thread topic is making things work for
general object types but specific standard key types. In C one might handle
that by taking an `offsetof` for where they key field is within an object and
`sizeof` for the size of object in the array. In Nim, one could do similar, but
it might be more "Nimonic" to more safely dispatch via some `sort template`
instead of a `sort proc`, e.g.:
template sort[T](inp: seq[T], keyField: untyped) =
when T.`keyField` is byte: ## XXX Handle all the standard types
... ## XXX good & stable algos for each one
myArray.sort(myKey)
The implementation might look nicer with a family of overloaded calls rather
than a big `when T.`keyField` is` dispatcher. I am not sure there is a clean
way to do that in this case. Each `when` clause should be able to dispatch to a
type-specialized case, though. So, it's not too bad.