Defect #15667
closed
Fix shadowing variable in ApplicationHelper#textilizable
Added by Ilya S almost 11 years ago.
Updated almost 2 years ago.
Category:
Code cleanup/refactoring
Description
fix using two different objects with same name, may cause problems
Files
I think it does not cause problem.
def test(text)
"test " + yield("yield " + text)
end
text = "aaaa"
text = test(text) do |text|
puts text
"block " + text
end
puts text
$ ruby a.rb
yield aaaa
test block yield aaaa
r10209 has tests.
yes, it isn't in this case, but may cause, because you create two different objects in same scope. Do you really think that's ok? Why do you rely on assumption that this piece of code will interprete right, instead of write it right?
and one more thing: code like this really hard to read, and maintain.
- Subject changed from Fix shadowing variable to Fix shadowing variable in ApplicationHelper#textilizable
- Category changed from Text formatting to Code cleanup/refactoring
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Target version set to 5.1.0
- Resolution set to Fixed
Committed the fix. Thank you.
Also available in: Atom
PDF