However Espruino must execute entire blocks of code at once. It's just the way it's written - it uses the main execution stack for parsing and to store program state, so it can't magically jump out of execution and resume where it left off.
Something that is only 'affordable' becuase by definition JS was thought to run single threaded...
I'm now asking myself: could there be places where an 'safe' interrupt in such a block could happen which would allow marking the conext in the stack and crating a new context for a 'pseudo multi-threading'? - of course with certain restrictions in what is possible and extra sync effort when accessing 'thread' shared 'things'?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Granted.
But interesting comment here (Architecture: Core processing of jsiLoop) - and that was what I was thinking about when saying '50ms, that's not much...':
Something that is only 'affordable' becuase by definition JS was thought to run single threaded...
I'm now asking myself: could there be places where an 'safe' interrupt in such a block could happen which would allow marking the conext in the stack and crating a new context for a 'pseudo multi-threading'? - of course with certain restrictions in what is possible and extra sync effort when accessing 'thread' shared 'things'?