From: Dumaiu Date: 2007-12-11T10:10:08+09:00 Subject: Re: How much would variable declarations in Ruby make you wince? On Dec 10, 5:57 pm, Jay Levitt wrote: > On Mon, 10 Dec 2007 13:44:15 -0800 (PST), Dumaiu wrote: > > In languages that support this, isn't it normal for the compiler to > > generate an error if you declare the same variable twice at the same > > scope level? So even if you do make this kind of mistake, it > > announces its presence on the first pass? > > Sure, but again, if you mistyped the chronologically-second, > semantically-first var as > > def say_hello(destination, first_name) > var destination Boy, I know that if I were implementing this 'var' stuff, I would make that illegal too! > var firsst_name ...And that wouldn't get written at all... > Hey, no error, no overlap! ...and the real issue would be how to handle the naming of block parms, which I don't think has been brought up yet. > > Ruby already has a way (several ways, actually!) for all these errors to be > announced on the "first pass". Test::Unit, RSpec, etc. I can get back to you once I've tried RSpec. -Jonathan