News for hackers. Stuff that matters.
Re:Curry flavored promises by bilalq on Monday April 28, 2014 @02:47AM (#7658550)
Do these promises work differently from most other implementations? Just sticking a `.then(console.log)` seems like it would yield `undefined` to the next function in the promise chain, no?
Re:Curry flavored promises by esailija on Monday April 28, 2014 @02:53AM (#7658574)
Maybe the code was untested or only tested in firefox or node, where `console.log` is bound (which is sane default for singletons if you ask me)
Re:Curry flavored promises by bendrucker on Monday April 28, 2014 @08:04AM (#7659373)
It's true that console.log is bound in FF and Node but that s not the issue here. Passing console.log to then will cause the next handler to receive the return value of the console.log call, i.e. undefined.
Re:Curry flavored promises by esailija on Monday April 28, 2014 @08:16AM (#7659406)
In mithril promises if you return undefined from then, the promise will fulfill with the previous value, I.E. it behaves like .tap in other promise libraries (because doing this in a .then like mithril does violates the spec - which is evidently surprising)

However, with unbound console.log the code doesn't work at all, this is the case in Chrome for example.

Re:Curry flavored promises by bendrucker on Monday April 28, 2014 @12:23PM (#7660961)
The breaks from A+ are pretty serious, both the treatment of undefined and releasing zalgo (http://blog.izs.me/post/59142742143/designing-apis-for-async...) and calling it a feature. Not on the hunt for a client side micro-framework but since I use a lot of modules that supply promises there's no way I'd use this.
Re:Curry flavored promises by phpnode on Monday April 28, 2014 @04:41AM (#7658867)
agree, this sounds like a bug, console.log() returns undefined so that's what the next promise in the chain should receive.