scope generalizedCIComparator // non-strings must be Comparable to each other // probably this is not that useful after all static simplyCached #C generalizedCIComparator() { ret new C; } final sclass #C implements Comparator { public int compare(O o1, O o2) { if (o1 cast S) if (o2 cast S) ret betterCIComparator().compare(o1, o2); else ret -1; else if (o2 instanceof S) ret 1; else ret cmp(o1, o2); } }