Wednesday, September 28, 2005

Dynamic typing and error checking

For people who get used to Eclipse or other great IDE, coding in ruby has some dark sides. For example, there is no compilation, so error checking only happens at runtime. Normally after you write a program, you run it, find a bug, fix it and repeat the process again and again. Since the program always stops at the first error, it is very inefficient. Most of the people would prefer the IDE to detect errors (like typo) while they are typing.

Some people believe it is the fault of "dynamic typing". Actually it is not, the poor IDE is the one to blame. As long as the language is strong typed, a compiler(or part of an IDE) is able to do lots of type inference, then validation. You do not have to wait it until runtime. Static typing make type checking easier, in some case even better. But dynamic typing language itself does not prevent you to do it. Unfortunally there is no ruby IDE doing that.

UPDATE(10/11/2005): Eric Lippert has a new post on this topic today[2]. MS's script engine(JScript and VBScript) can check syntax errors without actually running the code, but unfortunately it always stops at the first syntax error.

[0] Compiling in Vain
[1] Typing: Strong vs. Weak, Static vs. Dynamic by Aahz
[2] Checking For Script Syntax Errors by Eric Lippert


Post a Comment

<< Home