I stumbled across this a while back and have been meaning to post it for some time now. It's probably the only balanced discussion of Emacs and (yes and, not vs) vi. Close your mouth and visit the page. Made me seriously consider jumping into Emacs myself.
Update on the Java 1.5 front. Enumerated types are generally well implemented. I particularly like that a switch statement on an enumerated type automatically has access to the scope encapsulating the enumerated names.
So instead of
...
enum Options { THIS, THAT }
...
switch(enumVar) {
case Options.THIS: ...
case Options.THAT: ...
}
you just type
...
enum Options { THIS, THAT }
...
switch(enumVar) {
case THIS: ...
case THAT: ...
}
However, it's a bit odd that the first option is a compiler error. Sure, you don't want people to think that they can mix different enum constants but if they want a little extra semantic info why not let them?
My biggest gripe, however, is that there's no way to take control of valueOf. This method allows you to pass in a String and get back the appropriate enum constant. How does it decide which string values you can use? I haven't looked too deeply into the mechanics but in the above example you could pass in either "THIS" or "THAT" which is marvelous until you're getting the strings from an external source and they contain characters that are illegal in an identifier. Like dashes. You can't provide your own static valueOf(String) method. The closest I came to achieving this involved trying to call the protected Enum(String, int) constructor. The JavaDocs have a mysterious statement about programmer's not being allowed to call this and indeed trying to generates a compiler error. I can only presume this is a "special case" because there's no construct in Java that allows you to enforce this and there isn't even an annotation associated with the method. These kinds of "special cases" bug me. So after a lot of wasted time I ended up writing a safeValueOf(String) method. Nasty.
Despite that niggling annoyance enums have turned out to be rather pleasant to work with.
Posted at 08:50 PM