Open emil14 opened 5 months ago
In Go we pass ctx context.Context argument explicitly. We solve 2 problems this way
ctx context.Context
Here we only talk about first problem - cancelation. How to cancel (terminate) execution before it naturally ends? E.g. by timeout.
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.
ctx
Are there better solutions? What other languages offer?
https://odin-lang.org/docs/faq/#context-system
TODO research
https://kotlinlang.org/docs/cancellation-and-timeouts.html#cancelling-coroutine-execution
TODO
Implicit Approach
Every component implicitly has :ctx context.Context inport. User is not allowed to add inport with such name explicitly. ...
In Go we pass
ctx context.Context
argument explicitly. We solve 2 problems this wayHere 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?