Re:153k Ether Stolen in Parity Multi-Sig Attack
by z3t4 on Saturday July 22, 2017 @05:05PM
(#14829372)
What you describe is the moment someone would usually go from PITA to Ninja! From programming sequential to async using functions. The WTF code:
The enlightenment:
In JavaScript you can now however replace var with let and it will be block scoped and the WTF code will work. It's sad though as people learning JavaScript now will not get the beauty of it and will be stuck in callback hell. Function scope in JavaScript pushes you in the right direction. It's like instead of teaching people how to fly, we give them roads so they can walk, like they are used to.
[ Parent
| on HN ]
Re:153k Ether Stolen in Parity Multi-Sig Attack
by int_19h on Tuesday July 25, 2017 @04:37PM
(#14851643)
It's way more than just async callbacks. For example, you may be using a lazy sequence abstraction, with high-order functions like the usual map/filter/reduce, but with a deferred implementation (i.e. they're only applied, and functions passed as arguments are evaluated, when the next item is read from the sequence). If you create such deferred sequences inside a loop, they will again capture the mutated counter.