Jim Freeze wrote:
> On May 7, 2006, at 6:18 PM, Talha Oktay wrote:
>
>> I would like to comment against posts which simply emphasizes that the
>> interpreter can not think for us. I know that of course. What if we 
>> could
>> tell the interpreter by saying that these are the variables that I am 
>> going
>> to use in the class scope, in a block, in a method or in global scope 
>> etc.
>> and ask the interpreter not to allow any other variable usage in the
>> specified scope?  Then the interpreter would definitely know our 
>> intent? I
>> meant that.
>
> One could do this. I'm not sure of the performance hit though. Probably
> wouldn't be used by experienced Rubyists.
I doubt very much there'd be a performance hit at all for this.
>> I am very much suprised when I receive a no method
>> error. Why do I have to run the statement just to see that object 
>> does not
>> have that method implemented.
>
> Try unit testing for a while and you will see. After doing
>   1) write code
>   2) write test
>   3) run test and see it succeed
>
I'm not sure why everyone automatically assumed he did not use unit 
testing.  Unit testing certainly can point out there -is- an error.  The 
fix he proposes for his problem (typoing variable names) tells him 
-where- the problem is.  Unit tests can tell you generally where you 
problem is but it still takes the debugging work to step in and find out 
what -caused- the problem.  I think people are doing Talha a disservice 
by assuming that if he just tested better his problems would go away.

Roy