Actions
Defect #15667
closedFix shadowing variable in ApplicationHelper#textilizable
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
fix using two different objects with same name, may cause problems
Files
Updated by Toshi MARUYAMA almost 11 years ago
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.
Updated by Ilya S almost 11 years ago
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.
Updated by Go MAEDA almost 2 years ago
- 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.
Actions