The Problem of Async Programming, and a Crazy Idea for Solving It
1–10 of 25 posts
Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#2Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#3Yes, because XML is too old to us.
Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#4An example in make (if I'm reading in the right direction) format which I'd argue is more readable and could scale much better would be:
doA: doC doE
doB: doD doE
doC: doE
doD:
doERe: The Problem of Async Programming, and a Crazy Idea for Solving It
#5With async/await, wouldn't the example just be:
let aOut = doA();
let bOut = doB();
let cOut = doC(aOut);
doD(bOut);
doE(cOut, aOut, bOut);
That is, it looks the same as the sync version.The difference is in the "do" functions themselves: they would be async (meaning they return a promise, and they accept promises as parameters).
Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#6These do give the described benefits, however, the tradeoffs are massive.
Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#7Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#8 Promise.all([
doA().then(a => doC(a).then(c => [a, c])),
doB().then(b => doD(b), b_; return b; })
]).then(([a, c], b) => doE(c, a, b))
No need for `new Promise(resolve => ...)`. Or with async/await: const [a, b] = Promise.all([doA(), doB()])
doD(b)
const c = await doC(a)
doE(c, a, b)
Is it worth introducing the complexity of visual programming to solve this 'problem'? I have a much harder time understanding the graph than the code.Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#9Doesn't seem new at all, just like functional programming with lazy values. The new part isn't the async it's the visual programming of which there are others. Does incorporation async make visual programming different?
Re: The Problem of Async Programming, and a Crazy Idea for Solving It
#10Callback hell was never about promises, but callbacks (!) which would require a third-party library or some gymnastics to implement control flow. Promises and async/await both solve it reasonably well. The problem presented can be rewritten as: Promise.all([ doA().then(a => doC(a).then(c => [a, c])), doB().then(b => doD(b), b_; return b; }) ]).then(([a, c], b) => doE(c, a, b)) No need for `new Promise(resolve => ...)…