Re:Write logic, not mechanics
by jahewson on Thursday April 19, 2012 @10:53AM
(#3863271)
The code doesn't actually work though, the very first example is broken:
Prints:
[ Parent
| on HN ]
I have already fixed that, it was a typo, I meant following instead:
var deferred = defer() // make promise
var a = deferred.promise
var b = sum(a, 1)
var c = sum(b, 5)
console.log(c) // eventually prints => 17
deferred.resolve(11) // fulfill promise
Re:Write logic, not mechanics
by streptomycin on Thursday April 19, 2012 @11:57AM
(#3863596)
The typoed syntax was nicer than the real syntax, unfortunately.
Re:Write logic, not mechanics
by ricardobeat on Thursday April 19, 2012 @12:14PM
(#3863706)
You were writing an article about it and didn't get it right on the first time - maybe that's the reason more people don't use it.
That, or a majority of the JS coding crowd is too novice to appreciate maintainable code better than copying and pasting "simple" plumbing all over the place.