Open zarutian opened 4 years ago
Two additional functions that might be handy:
const someAwait = async (args, which) => {
const awaited = await Promise.all(which.map((w, i) => (w ? args[i] : null)));
return which.map((w, i) => ( w ? awaited[i] : args[i]));
}
const someArgsAwait_method = async (target, verb, args, which) => {
return HandledPromise.applyMethod(target, verb, await someAwait(args, which) );
}
const someArgsAwait_function = async (target, args, which) => {
return HandledPromise.applyFunction(target, await someAwait(args, which) );
}
Specially, if these are at remote vats/sites, for enabling lots of pipelining where some of the arguments are unresolved at time of eventual send. I am up for bikeshedding better names for these functions though.
Here is a handy shim/polyfill/whatchacallit that will be usefull in conjunction with eventual-send. Allows for promise pipelined logic and arithmatic for those situations that warrant it.