Hi, I added async support to my pet language and after reading more about async programming, I have some questions.
Currently, in my interpreter, after every X evaluations, the interpreter will check whether there are pending futures and if yes, check their states, call the success or failure callback depending on whether the state is success or error. This can happen at ANY time, like inside a function execution, a for loop etc. And it can cause unpredictable behavior. However I couldn't figure out a better way. As in my language, all are evaluations - importing a module, calling a function, adding two numbers etc. Even if the interpreter doesn't do this automatically in the middle of execution, and only check futures at the end of main script. Unpredictable behavior is inevitable because when the user uses `await` to wait for futures, futures created elsewhere will be checked at the same time and callbacks will be called. Means a future's callback can be invoked when least expected. Is this something I need to worry? Or is this part of async programming and we all must live with?