In discussions about language features for Java 7, I've seen many suggestions that mythical 'other programmers', presumably ones who don't read/write blogs, will write terrible code that uses the language feature. Programmers will write terrible code, regardless of the restrictions you place on them. If you make it harder for them to write their terrible code, they will learn more slowly. Many even stop learning, but that's a subject for another day. Personally, I've had some ridiculous ideas over the years, and those ideas only lived so long because I couldn't try them out very easily. Some good ideas died for the same reason. In C and Lisp, you are the master over the language. That seems to be true of Python, Ruby and Smalltalk too. Of course, C's #define is so coarse as to make communication between master and servant a bit stilted, but the theory's there. In Java, C#, Pascal and other academic languages, you are the servant. Of course, any servant can learn to express himself, but it takes longer. It's like being forced to speak another language, such as the Welsh were. I expect that the literary production of the Welsh people suffered for a time when they were forced to speak English. If I want a switch statement that works on Strings, I can write it myself, as a developer, not a compiler-writer, in a less restrictive language. Then I can come across problems with it (such as fragility) and find a better solution. If I instead have to boilerplate out a load of if..else statements, I'll take longer to realise that my idea is faulty, rather than the switch statement being inflexible, because I'll be blaming the wrong thing for my boilerplate. If you're worried that operator overloading would let your fellow programmers write awful code, ask them what they would do with it. If you worry about what open classes would result in, write a program in Ruby. If you think that the program was too small to determine it, write a bigger one. If you worry about Lisp macros, write some, or define the following macro: (defmacro defmacro () ()) Now you can't define any more macros. You can remove defun in the same way. I imagine that wouldn't be so good for your career.
CodeSOD: Trim the Tree
7 hours ago