3 ms·
var resultp = add(do_x(), do_y(); do_z(resultp); do_foo(); You're code will block on add. This code only blocks on unrealized promises, that is do_foo gets
by swannodette 17y ago
var resultp = add(do_x(), do_y();
do_z(resultp);
do_foo();
You're code will block on add. This code only blocks on unrealized promises, that is do_foo gets to execute. This is _more_ concurrent.
- tolmasky 17y agoYou're no longer arguing your original point, or at least, you're no longer arguing against me. Your code and my code are now nearly identical, except for the fact that you use an add function and I use an add operator. In fact, if I just say "my add operator can manipulate promises" or whatever, then they become 100% the same. Since my original point was that I'd like to use a preprocessor to make asynchronous programming as easy to transition to as possible, this would be very easy to achieve (just replace exp1 + exp2 with add(exp1, exp2)). That's what I meant by "just work", not "almost work". The goal was to not have to use callbacks and nesting, a point that both our code snippets have reached, so I'm not sure exactly what we're arguing about.
- swannodette 17y agoHeh, we basically understand each other now, a couple more illustrative examples always helps point that out. And yes a preprocessor to convert operators to functions would be quite useful.