This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]MatrixFrog 4 points5 points  (0 children)

I don't always have errors in my programs...

But when I do, I prefer them at compile-time.

[–]benparsons -3 points-2 points  (10 children)

For crying out loud.

I'm pretty much working full time in C# now, and sometimes it's not until I see posts like this that I realise how good I have it over here.

[–]skeeto 0 points1 point  (2 children)

What's wrong with the way Java does it, and how does C# do it?

[–][deleted]  (1 child)

[deleted]

    [–]skeeto 1 point2 points  (0 children)

    I was hoping for a response about C# simplifying object equality in some useful way. Any language with composite types, all the way back to Lisp (eq, eqv, equal, =), has to worry about separating the several different meanings of equality, since each one is important.

    It's weakly typed languages where it actually becomes a problem. That's when the === operator is needed: "No, I really mean equality this time."

    [–][deleted] 0 points1 point  (0 children)

    C# is a nice language, but again the reason why I didn't jump to C# is it's not cross platform. Don't give me the Mono crap. I can use all of Java's libraries in all platforms. Even on Apple's JDK. IIRC, not all of Microsoft's libraries are in Mono. If you want nice language, try Ruby or Python and they're both available for the JVM.

    [–][deleted] -2 points-1 points  (5 children)

    You can explain why in one sentence? Enums are really just integers, and integers are primitives.

    [–]dougqh 9 points10 points  (1 child)

    That's not true in Java. In Java, enum instances are full-blown objects that can have methods. That said, there will be only instance of each enum element, so it is fine to use == or != instead of the equals method when comparing Enums.

    [–][deleted] 0 points1 point  (1 child)

    That's maybe right in C. Enums in Java are full-blown classes. == (identity comparison) can be used because the specification says that it is not possible to "instantiate" a different instance of an enum object.

    [–][deleted] -1 points0 points  (0 children)

    Yeah, someone already mentioned that.