3 ms·
Since Melag seems to be an interpreted language embedded in C, it would be very useful to compare it with established alternatives, first of all, Lua (has corou
by nine_k 4y ago
Since Melag seems to be an interpreted language embedded in C, it would be very useful to compare it with established alternatives, first of all, Lua (has coroutines) and QuickJS (has async generators and promises).
My understanding is that in Lua and JS coroutines are cooperative, and in Melang, preemptive: this is the key advantage.
- cmacleod4 4y agoTcl is another well-established language which has had full coroutine support for 10 years now. As with Lua, a Tcl coroutine has to explicitly yield for execution to switch to another coroutine. I would not see preemptive scheduling of coroutines as an advantage, it opens up all the unsafe concurrency issues you get with threads, but without getting threads' advantage of running on multiple cores to compensate. Coroutines in Tcl also integrate cleanly with the existing event system, this allows writing event-driven code without the awkwardness of control inversion, also known as callback hell.