2022-04-13 22:46:39 <rick_carlino1> I think I figured out how to fix the Javascript implementation of RetroForth!
2022-04-13 22:47:05 <rick_carlino1> The problem with the last implementation that I looked at was that it had a long running while
loop to run through Nga opcodes.
2022-04-13 22:47:55 <rick_carlino1> That means that the JS environment can't service event function calls, so you can't move the mouse or click anything on the page while RetroForth is executing (in newer FF versions, it would actually kill the script)
2022-04-13 22:48:08 <rick_carlino1> I tried to fix this by doing a refactor but I was never successfuly.
2022-04-13 22:48:17 <rick_carlino1> *successful
2022-04-13 22:48:54 <rick_carlino1> I just realized it would be pretty easy to do via the new-ish "generator" function. Very little modification of the existing codebase would be required. Going to try it out now.
2022-04-13 22:53:45 <rick_carlino1> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
2022-04-13 23:19:42 <rick_carlino1> It works!
2022-04-13 23:20:33 <rick_carlino1> crc I will try to post this to Github soon. It is very slow, but it is nice because you can execute the script and still have control of the browser (does not hang, UI stays responsive, minimal changes)
2022-04-13 23:22:33 <rick_carlino1> I just ran a benchmark, it tooks 1733 milliseconds to run the "99 bottles of beer" example from retroforth.org
2022-04-13 23:23:09 <rick_carlino1> Which is not great, but the important thing is that the UI stayed responsive, which is important for something like a "RetroForth Playground", which might be possible now.
2022-04-13 23:26:12 <rick_carlino1> (18 ms / token, looks like)
2022-04-13 23:32:13 <rick_carlino1> https://github.com/RickCarlino/retro-ts
2022-04-13 23:32:41 <rick_carlino1> needs a lot of cleanup, but it works now
application/octet-stream
This content has been proxied by September (3851b).