Re:Jaspy – A Python VM written in JavaScript
by foota on Saturday April 16, 2016 @05:01PM
(#11512231)
I'd be interested to see how threading support was implemented, seems difficult to do in a browser environment.
[ Parent
| on HN ]
Re:Jaspy – A Python VM written in JavaScript
by chrisseaton on Saturday April 16, 2016 @05:55PM
(#11512429)
It's easy: you could just run n instructions of thread one, then n instructions of thread two, and so on in a loop. To not freeze up the browser, you could periodically yield to it and set a timeout to start running the next thread again.
I guess so. I think I was thinking about concurrently running multiple threads.
Re:Jaspy – A Python VM written in JavaScript
by chrisseaton on Sunday April 17, 2016 @06:59PM
(#11516741)
That is already concurrent. Do you mean in parallel? Yeah not easy to do that, you'd have to set up web workers and I think sort of manually recreate the shared state with your own coherence protocol!