From: Jamis Buck Date: 2005-12-08T03:06:59+09:00 Subject: Re: Syntax checker? On Dec 7, 2005, at 10:32 AM, William E. Rubin wrote: > Thanks for the explanation. But there certainly could at least be a > way to produce warnings. In your example, it could warn (without > having executed any of your code) that X might be uninitialized. > > I'm not saying Ruby should do this as a default, but it would be nice > to have an option (or a separate tool) to do so. > > I mean, I just had a Ruby script crash because one line of code > contained "RegExp" instead of "Regexp". This script had been working > fine for quite some time, but it just happened to get into the > situation where that line was encountered for the first time. It > would > have been nice to have had a tool that told me "Warning: RegExp might > not exist". At the risk of sounding pedantic, Test Driven Development really is the best solution to this. Not only will it catch the cases you are talking about, but if done right it can even catch the dynamic cases that were given as counterexamples earlier. If you have tests that cover your code sufficiently, you'll find these kinds of problems much, much sooner. And Ruby makes TDD so easy it's almost criminal to not take advantage of it. - Jamis