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: The feature currently called "Generics" should be called "Parametric Polymorphism" #40537
Comments
I completely agree with what you say but fear that the "generics" word, from Java, has become the generic term for the general concept. |
@robpike -- I understand but I don't think we should get this wrong just because Java has (if Java jumps off of a bridge...). I feel like there was a lot of confusion about what exactly this new feature entails and I think naming it correctly could help users understand it without having to wade through the murky terminology. |
I called it parametric polymorphism for a while, but many people just didn't understand what I was talking about. Also, although I think the version in the design draft is parametric polymorphism, it is not the same as some other languages that use the term parameteric polymorphism, because the Go type parameters are bounded by something that is similar to a subtyping relationship but actually isn't one (at least not according to the Go type rules). See also https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#background. Anybody who wants to should go right ahead and call it parametric polymorphism. But I don't think we would get any benefit from doing so in general. |
While Java definitely established the term generics for today's programmer generation, the term is actually older. The programming language Ada had a "generic" keyword since at least 1983 if not 1978. (The Internet appears to have only the 1983 language specification.) The 1989 paper "Generic Programming" by Musser and Stepanov uses the term generics and is based on the experience developing the Ada Generic Library. Stepanov later developed the Standard Template Library (STL) for C++. Research into the concept predates Ada. Milner, who led the development of the ML language, published the paper "A Theory of Type Polymorphism in Programming" in 1978. The abstract mentions that the concept has already been implemented for ML. |
@ulikunitz -- sure, the notion of generic programming has been around for a while. What I have issue with is the term "generics". So yes, as a keyword, I think this is a subtle but important point -- though I'm sure I'm missing out on some history so I'm definitely here to be educated. Again, my point is: the term "generics" isn't well defined, is difficult to "google" for or find as a term-of-art. Therefore, I think it is a bad name for the feature that is being added. We should call it what it is: Parametric Polymorphism (maybe with Bounds). The name is self descriptive -- if it seems a little dense, simply looking up the definition of each word should make the intention of the feature clear: Parametric: having to do with parameters Again, I think that is a good way to talk about he upcoming feature and we can still talk about what it allows which is generic programming in the sense that you describe. |
I feel like "the train has left the station" on this. I was hoping to appeal to have this semantic issue cleared up before the term "generics" gets further entrenched. I'm also open to simply being wrong. I figure this is what the proposal process is for -- to vet ideas like this. |
@ulikunitz -- the term "generics" is used only once in the "Generic Programming" paper by Musser and Stepanov but not in the same way as we're talking about them -- it seems to be referring to Ada functions that are declared as So for Ada, the use of the term "generics" seems to be tied to the syntax. To my knowledge, Go isn't adding a Finally, even this wikibook on Ada generics starts by talking about PP first: |
I'm going to close this issue. Sorry. This battle has been lost. |
I feel like "generics" isn't a very well defined term and the feature that Go is adding is precisely parametric polymorphism.
I propose that the Go project start rephrasing what we call "generics" as "parametric polymorphism" to more clearly and precisely describe the upcoming feature. This includes changing the verbiage in the proposal, future blog posts, commit messages, etc.
I think Go has done an excellent job at the "naming of things" part of software development. I think this is an opportunity to get the naming of this feature right.
The text was updated successfully, but these errors were encountered: