-
-
Replying to @increpare
What was the problem with variables in functions in ActionScript? Var hoisting?
3 replies 0 retweets 0 likes -
Replying to @webbedspace
It had function-level variable scoping. Which meant that the first for loop for a function would have to declare the int i but not subsequent ones. Why not just make it a class member? lol...
3 replies 0 retweets 5 likes -
Replying to @increpare
I just want to say that this demonstrates that the "for i" syntactic structure is the real problem at the heart of this mess.
1 reply 0 retweets 1 like -
Replying to @webbedspace
I don't think it does! Any loop construct introducing a new variable would've had the same problem due to function scoping, right? (Or if that is it, what would you prefer?)
1 reply 0 retweets 0 likes -
Replying to @increpare
For one thing, for-each loop structures encourages the variable being looped over to be explicitly named (as "block" or "enemy" or whatever), eliminating the low-level i(ndex) variable that every single for-i loop uses,
1 reply 0 retweets 0 likes -
Replying to @webbedspace @increpare
moreover, I'm not familiar with AS3 but I suspect support (syntactically and performance-wise) for something resembling the ES5 .forEach() function family, which uses functions/"lambdas" for iteration, should've been provided instead.
2 replies 0 retweets 0 likes
It had forEach. But people didn't use it mostly, because it wasn't as convenient as the for syntax ( e.g. https://stackoverflow.com/questions/7645560/as3-which-is-faster-a-for-loop-or-the-foreach-array-function … ).
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.