Proposal: use "One More Point" to handle async functions
jason.orendorff at gmail.com
Wed Sep 28 14:20:45 UTC 2016
On Tue, Sep 27, 2016 at 10:23 AM, Li Xiaolong <898310778 at outlook.com> wrote:
> 3: the async function calls identically with sync functions, makes it hard
> to check out if the function is async without jumping to the definition.
> But OMP can easily be recognized.
Usually, async calls will be marked with `await`, which to me seems
somewhat easier to spot.
On the other hand it's true that the function call itself is just a
function call. One nice consequence is that you can call an async function
without immediately blocking and waiting for it to finish. For example,
let p1 = start_download(); // start two things at once
let p2 = start_query();
let file = await p1; // wait for results
let result = await p2;
Is that possible with OMP syntax?
In your proposal, what would happen if you called an OMP async function
(one that ends with a `.return`) using `plain.method()` call syntax? What
if you call a sync function or method using OMP call syntax?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss