From: "Mark J. Reed" Date: 2003-07-17T01:49:39+09:00 Subject: Re: Other languages' features in Ruby BG = Ben Giddings JJ = John Johnson BG> Is there a good way to get what type checking does for you? Maybe some BG> catching typos, like calling the class variable @my_var, but ending up BG> using it as @myvar. JJ> Test First Design? BG> Ok, but compare: BG> "Test 473 failed: expecting 17, got 18" BG> with BG> "warning: on line 765 of myfile.rb: @myvar may not have been initialized" BG> I think the second one is more useful, and it is a typical type BG> of output from compilers for compiled languages. It is much quicker and BG> zeroes in on the actual problem faster than a test failing. I'm of course BG> not advocating that Ruby become a compiled language, but it would be nice BG> if there were a way to do the kind of checks that a compiler does. Well, Ruby *is* a compiled language; it's just not compiled all the way to a persistent standalone executable. It's certainly possible to do those sorts of checks in the compilation phase of a language like Ruby; a good example is the 'use strict' pragma in Perl, which requires that variables be declared before use. Ruby could similarly have an option that, when enabled, would require variables to be initialized before being referenced. Of course, as regards @my_var vs @myvar vs @myVar, the best approach would be to pick a naming style and stick with it. :) -Mark