Why not consider implementing a stackless coroutine? #172
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Coroutines in Nelua are designed like in Lua, so they are stackful as in Lua, and there are no plans to support stackless coroutines in the compiler. This is a controversial topic but I believe stackful coroutines are more powerful, useful and easier to use, although it comes with some disadvantages that we are aware of, like it may use more memory footprint and it requires proper support for the target machine, usually via some assembly coding, thus it is not cross platform as stackless. Seems like you are compiling for MIPS architecture, the Nelua coroutine implementation is backed by the minicoro project, it provides stackful coroutines for C, it was also created by myself and currently it does not support MIPS yet, but it could. To do the MIPS implementation it requires some MIPS assembly coding, PRs are welcome there. The |
Beta Was this translation helpful? Give feedback.
-
Is it possible that it looks like stackful in nelua but is stackless when it is translated into C, such as dividing it into multiple C functions with yield ? |
Beta Was this translation helpful? Give feedback.
Coroutines in Nelua are designed like in Lua, so they are stackful as in Lua, and there are no plans to support stackless coroutines in the compiler. This is a controversial topic but I believe stackful coroutines are more powerful, useful and easier to use, although it comes with some disadvantages that we are aware of, like it may use more memory footprint and it requires proper support for the target machine, usually via some assembly coding, thus it is not cross platform as stackless.
Seems like you are compiling for MIPS architecture, the Nelua coroutine implementation is backed by the minicoro project, it provides stackful coroutines for C, it was also created by myself and currentl…