On Tuesday, February 25, 2025 at 4:29:44 AM UTC Robert Engels wrote: You don’t need co routines if you have real concurrency. The generator use case is simply an optimization that wouldn’t be necessary if the concurrency model was more efficient - and there was a more expressive way to use it.
Hi Robert, I always enjoy your thoughts and perspective on these things. I certainly agree that, strictly speaking, you don't need coroutines when you have goroutines. But, having implemented a lexer and parser with goroutines instead of coroutines (e.g. https://github.com/glycerine/zygomys/blob/master/zygo/parser.go and lexer.go) I strongly suspect that coroutines would make for... a much "nicer" architecture. The resulting lexer and parser back-and-forth I suspect, would be easier to read, understand, modify, and use. In fact, I hope to re-write that code using coroutines in the near future because of this. Having a ton of different parsing goroutines running in the background, and shutting them down when not needed, and starting them up again, when needed again, simply makes for alot of "goroutine managment" hassle that it appears could be trivially avoided with coroutines. Or, perhaps there is a simpler way to use goroutines to do parsing that I did not discover--and that you have in mind. I'd be curious to see what that would look like. Feel free to suggest how to refactor that lexer and parser code while still using only goroutines, if it helps to make the ideas less abstract and more concrete. Best regards, Jason I think the Java loom project has proved that the Go concurrency model is ideal. Reading up on “structured concurrency” is a great exercise. p.s. if you have resources/links in mind about "structured concurrency", I'd be interested to look into them. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/8f12ea21-0d26-4864-8a08-a6c558a10ed7n%40googlegroups.com.