Re:How to avoid the assignment statement
by cperciva on Monday July 12, 2010 @04:45AM
(#1507236)
In a 50 line function with 5 variables, I find it much easier to look at 5 lines of variable declarations to figure out how I declared a variable than to scan through up to 50 lines of code.
[ Parent
| on HN ]
Stop writing 50 line functions.
Re:How to avoid the assignment statement
by loup-vaillant on Monday July 12, 2010 @04:56AM
(#1507259)
So, declaring variables at the top of the function makes it easy to find them. Now how do you find the point of initialization?
declare x |
... | ...
initialize x | declare & initialize x
... | ...
use x | use x
In both cases, you will have to scan for the whole function, or hit the "search" hotkey. Or maybe sometimes you just need to know when `x` were declared, but not what value it holds?