Open xen1024 opened 1 year ago
Hm... given that await
waits for the calculation of future values, what if you can nowait
to retrieve past values?
Hm... given that
await
waits for the calculation of future values, what if you cannowait
to retrieve past values?
Sounds good, this will provide the flexibility of "nowait". Predicting answers from the future will also improve usability.
// Past
const var response = nowait(-1) request(http)! // no wait and return last response
nowait(2) request(http)! // no wait and return previous response by index 2
nowait(2h) request(http)! // no wait and return previous response 2 hours ago
nowait(365d) request(http)! // no wait and return previous response 365 days ago
nowait(7+2i) request(http)! // no wait and return previous response from a complex number
// Future
nowait(+2s) request(http)! // no wait and return predicting the future in 2 seconds
nowait(10q) request(http)! // no wait and return predicting the future using 10 qubits
nowait
is inverseawait
Just like
await click(); await ..; await ..
butnowait nowait nowait
.Use await as default mode and nowait for no wait statements to understand better and lint that instruction will not wait. Very useful for teaching beginners about asynchronous processes and multithreading because repeat, repeat, repeat!
Possible modifications.