|
|
|
|
|
by klabb3
1243 days ago
|
|
For context (hah), I’m talking purely in terms of cancelation and not context.Value() which is a whole other story, and imo should never have been created. > I would hate having context be inherited from the parent caller. By default. All I’m arguing is that canceling is in 99% what should be done. You could override that when it makes sense. If your parent wants you to terminate, then in what instances would you keep going? There are some use cases of graceful teardown, but I haven’t seen a single 3p developer give a shit about that, and I’d rather have them respect my desire to yield control back to me, than to go on forever because they forgot to carefully litter their codebase with SetDeadline in their IO calls. > Do you really want to have to read all possible call-sites to ensure that the context is what is expected when `foo()` calls `bar()`? Why would I? Unless foo or bar is a unicorn that requires the caller to prepare a custom context, it would work the same as mindlessly passing the context from parent to child, which people do today. Take the converse example: if today I add a call to bar (no context param), I need to make sure it doesn’t block forever, and if it does, it makes my entire call tree non-cancelable, even if I have been diligent about it in every other place. It only takes one non-cooperative player to destroy that property, and the default is to not be cooperative. |
|