Name: Anonymous 2012-04-27 16:10
All other languages are either not compiled languages with static typechecking or have too few eligible users. C# would also be an option if it wasn't Windows-only.
U=uncountable A=countable.U=all possible sets A=countable A`=uncountable.
int, and only the documentation specifies which integer values are allowed, then static typing doesn't save you from returning nonsensical values.
java.util.Posets.RelativeOrdering is better. You could use it like this:public static Object[] sortTuple(Object o1, Object o2) {
java.util.Posets.RelativeOrdering ro = java.util.Comparator(o1, o2);
if (ro == java.util.Posets.RelativeOrderingConstants.Equal) {
return {o1, o2}; /* Stable sort */
} else if (ro == java.util.Posets.RelativeOrderingConstants.GreaterThan) {
return {o2, o1};
} else if (ro == java.util.Posets.RelativeOrderingConstants.LessThan) {
return {o1, o2};
}
}ints to signify partial order is an established practice and perfectly acceptable. Wrapping it in another type (for ``clarity'') is ENTERPRISE over-engineering, and doesn't even solve the problem mentioned.data Ordering = LT | EQ | GT.