nevalang / neva

🌊 Flow-based programming language with static types and implicit parallelism. Compiles to native code and Go
https://nevalang.org
MIT License
85 stars 7 forks source link

Cancelation Problem #668

Open emil14 opened 4 weeks ago

emil14 commented 4 weeks ago

In Go we pass ctx context.Context argument explicitly. We solve 2 problems this way

  1. Cancelation
  2. Passing values without "props drilling"

Here we only talk about first problem - cancelation. How to cancel (terminate) execution before it naturally ends? E.g. by timeout.

On Go Way

I see a downside of Go's solution. Extra ctx argument is a boilerplate and once it appears somewhere it can spreads throwout the call-stack.

Are there better solutions? What other languages offer?

emil14 commented 4 weeks ago

Odin

https://odin-lang.org/docs/faq/#context-system

TODO research

emil14 commented 4 weeks ago

Kotlin

https://kotlinlang.org/docs/cancellation-and-timeouts.html#cancelling-coroutine-execution

TODO