Bruce Pascoe
Bruce Pascoe
As an example of where this would be useful in a practical scenario, take this example in miniSphere: ```js const TAU = 2 * Math.PI; var stream = new SoundStream(44100,...
Having put some thought into it, the async requirement for Promises makes sense, particularly in a language with closures. I initially thought it might just be to prevent excessive recursion,...
It should be noted that ES6 _does_ mandate an event queue - the Job Queue, and states explicitly that Jobs (of which Promise settlement is one type) must not run...
You'd have to clarify what you mean by "outside the application".
Ah, okay, so like `system.run()` in minisphere. The simplest case I'm thinking of is where a Promise callback modifies a global variable. If the callstack is not empty you've just...
It can't - it can only see the side effects (I did say "indirectly" :). I guess my point is that, since Ecmascript says "empty callstack first", compliant code has...
On the other hand, if there is such a call as `system.run()` in the API, then application developers should expect that calling it may cause a Promise handler to run.
Concrete case off the top of my head: Function creates Promise -> returns -> program does various unrelated things -> calls into C which decides to resolve Promises -> Promise...
As long as no _application_ calls are in progress when all that happens, then I would almost certainly deem that acceptable, even if it borders on being a Rube Goldberg...
By "application" I meant the program which created the Promise object. If resolution happens in JS at a level above that, that's fine too.