-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proposal: context: add Root as an alias for Background #51573
Comments
Why this is not enough?
Use:
|
context.Background
to context.Root
Yes, getting rid of |
CC @Sajmani |
@changkun, I appreciate the consideration. There remain two suboptimal points that would need be solved, however:
@ianlancetaylor, I had given consideration to exactly what you propose as well. If you folks are OK with it, I would be as well. The deprecation protocol is well enough understood these days to do the change. |
This is the first I'm hearing that |
"background context" is definitely an idiomatic phrase in American English, meaning basically "how we got to this point". There's no sense that there can only be one of these, whereas |
context.Background is already a synonym for context.TODO. Is adding a third alias going to make a meaningful improvement? |
How do you figure? |
Oh dear. Please accept my apologies, I had in my mind that one called the other, perhaps it did at one point in the past, but that is no correct. https://cs.opensource.google/go/go/+/master:src/context/context.go;l=208 |
I'm very confused about this. |
This proposal has been added to the active column of the proposals project |
Based on the discussion above, this proposal seems like a likely decline. |
Sorry for being a bit incommunicado since filing this issue. It’s been a
hectic couple of weeks. Let me confer with some peers on the above, and we
can determine next steps.
|
In terms of broad strokes, my ideal preference would be to rename the API in the so-called Go 2 (in other words, removing the name
I think the temporal aspect of when what should be done is confounding the discussion. In terms of measuring confusion and misuse, I did some examination of our monorepo and comments that were made in code review. We've internally had guidance about avoiding extraneous background context usage in non-roots for about 18 months. In that time, code reviewers flagged about 2,500 instances erroneous
Everything's in the name. As I outlined in the opening description, "background" doesn't have a particularly clear meaning nor implication nor insinuation that it is — well — the root from which all things are derived (the very beginning). For better or for worse, in the domain of computing, root is an unambiguous and established term. My expectation is that with a better name developers would think twice: is this place (where I am using the context API) really the root of the operation? |
What was the erroneous use? That they should have been using a context that had been passed to them? I don't see how renaming it helps that case. |
There are numerous problem classes in descending order of frequency:
This item is self-standingly concerning one.
|
Will leave this open for another week, but I still don't see any significant inherent difference between the words Background and Root. Neither is terribly meaningful on its own. They will have the meaning we assign to them in docs and such. |
No change in consensus, so declined. |
This proposal is probably best suited for Go 2 due to Go 1 stability guarantee, but hear me out:
I would like to propose we rename
context.Background
tocontext.Root
. The reason is due to seeingcontext.Background
's accidental misuse overuse in program and operation leaves. The documentation, to wit:I have a supposition on why: the term "background" does not easily lend itself to being understood as a program or operation root; whereas all of the things in the quoted excerpt above can be thought of as either a program root or an operation root. Granted English has no formal authority on usage of vocabulary, but if we compare the definitions offered by Merriam Webster, it becomes more clear that background is inappropriate
background: I've always felt the name "background context" as we use it today hearkened from the idea of "background radiation", but that metaphor has limited value.
root: At least three subdefinitions of "root" match the idea of what a background context is, and we also have deep precedent in the collective knowledge of software engineering with "search roots", "root directories", etc.
My feeling is a rename would prevent a lot of misunderstanding and minimize the urgency for static analysis to flag its accidental misuse. It'd help the ecosystem. I say this bringing my experience using the API since its inception in 2014 and helping thousands of engineers use the language.
The text was updated successfully, but these errors were encountered: