Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Is Java the only practical choice for webdev?

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.

Name: Anonymous 2012-04-30 13:39

>>75
I'm sure returning an instance of 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};
    }
}


SO BEAUTIFUL

Returning 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.
Type systems aren't the answer here; what's needed is a powerful way to make arbitrary invariants explicit, but as far as I know, no general-purpose programming language has the ability to do that at this point (SQL constraints come closest, I guess).

The reason for that is that it isn't actually a problem, because programmers (even Java programmers) can be expected to have a vague idea of what they're doing. It's unnecessary for broadly the same reason static typing is: it attempts to solve a non-problem.
The difference with static typing is that it would actually succeed.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List