I
Ilja Tabachnik
Hi All !
I'm new to Ruby so my question could look a bit... hmmm.. stupied.
However I do did a search in comp.lang.ruby archieves and
found a lot of questions similar to the my one - but no definite
answer. Reading Programming Ruby also didn't help.
I really don't understand how one could find errors (typos) in
variable names, like in this example:
def do_something(arg)
result = 1
# some code...
if some_condition
reslt = 2 # a typo here!!!
endif
# more code ...
result
end
The code above is OK for Ruby - even no warnings. I could spend
hours or even days finding out why the damn thing doesn't work!
(given there are many thousands lines of code)
So I'd like to ask - is there really no way do somehow "declare"
local variable (like "use strict" and "my" in Perl)? If no, what's
"The Right Way" to deal with such situations in Ruby?
Many thanks in advance,
Ilja.
I'm new to Ruby so my question could look a bit... hmmm.. stupied.
However I do did a search in comp.lang.ruby archieves and
found a lot of questions similar to the my one - but no definite
answer. Reading Programming Ruby also didn't help.
I really don't understand how one could find errors (typos) in
variable names, like in this example:
def do_something(arg)
result = 1
# some code...
if some_condition
reslt = 2 # a typo here!!!
endif
# more code ...
result
end
The code above is OK for Ruby - even no warnings. I could spend
hours or even days finding out why the damn thing doesn't work!
(given there are many thousands lines of code)
So I'd like to ask - is there really no way do somehow "declare"
local variable (like "use strict" and "my" in Perl)? If no, what's
"The Right Way" to deal with such situations in Ruby?
Many thanks in advance,
Ilja.