I suggest avoiding the term "non-async" when explaining the problem. Async is short for asynchronous and a non-asynchronous function is a synchronous function and that is not what you mean. e.g. Although loopWithDelayNonAsync isn't an instance of AsyncFunction it is an "async" (commonly used in code as shorthand for "asynchronous") function as it returns a Promise (which represents the fulfillment of an asynchronous operation).
One simple way to avoid this ambiguity would be: "How would you go about implementing a state-machine-style version of the following async function without using the async/await keywords ..."
Dad, self-employed, problem solver at heart, async all the way. Formerly a principal software engineer at Nuance Communications. Occasionally I tweet, blog and answer my own StackOverflow questions.
I was actually contemplating how to avoid this ambiguity, but decided to stick with "non-async" for its literal meaning, no async modifier. Moreover, an asynchronous (in common sense) function doesn't even have to return a Promise, it can be any thenable. Anyhow, it's a great point, thank you. I agree I need to change the wording, and I think I'd also add "... without yield" :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I suggest avoiding the term "non-async" when explaining the problem. Async is short for asynchronous and a non-asynchronous function is a synchronous function and that is not what you mean. e.g. Although
loopWithDelayNonAsync
isn't an instance ofAsyncFunction
it is an "async" (commonly used in code as shorthand for "asynchronous") function as it returns aPromise
(which represents the fulfillment of an asynchronous operation).One simple way to avoid this ambiguity would be: "How would you go about implementing a state-machine-style version of the following
async
function without using theasync
/await
keywords ..."I was actually contemplating how to avoid this ambiguity, but decided to stick with "non-async" for its literal meaning, no
async
modifier. Moreover, an asynchronous (in common sense) function doesn't even have to return aPromise
, it can be any thenable. Anyhow, it's a great point, thank you. I agree I need to change the wording, and I think I'd also add "... withoutyield
" :)