Stephen R. van den Berg wrote:
Pontus ??stlund wrote:
22 maj 2016 kl. 16:40 skrev Marcus Agehall (nu med K-m??rkt fastighet och ny elcentral) @ Pike (-) developers forum 10353@lyskom.lysator.liu.se: A bigger problem imho is the difference in how promises are actually resolved. In JavaScript, the return value of then() is always a *new* promise which then allows for chaining. In Pike, we return the same promise object. This means that code like
I agree that a new promise (or future rather) should be returned.
It seems that this has not been fixed yet. I'm trying to build a SOAP interface using Promises. It is messy at best.
Do we agree that this needs to be fixed? Any objections if I try to fix it?
While inspecting the code, I find a larger difference between the JavaScript then() API and the current on_success() with regard to setting the result value using return, instead of the success() or failure() method.
So, instead of changing the existing API, I decided to add the JavaScript then() API (which I find easier to work with when chaining promises/futures).