# Synonym request: [template] -> [generics]

As far as I can tell, is basically just C++'s version of .

If this is correct and there is no other appropriate use of the tag (the tag says it's not supposed to be used for "template-meta-programming"), then I recommend we synonimize into .

As a note, this tag almost certainly has some improper uses for things like "template-meta-programming" which the wiki cautions against, and probably some other things, so it'd need some clean-up.

• I agree, especially since Rust calls them generics but they act more like C++ templates than Java generics. – o11c Jul 17 '15 at 1:39
• I don't know enough about C++ to know for sure that a C++ template is equivalent enough to a Swift/Java/C# generic. – nhgrif Jul 17 '15 at 1:40
• Language-wise, there is a big difference between C++ templates and generics in a language like Java, for instance, however, since both tags seem to represent the same concept, creating the synonym might be adequate. – glampert Jul 17 '15 at 1:43
• @glampert Would you mind posting, as an answer, an elaboration on the differences between C++ templates and say Java generics? – nhgrif Jul 17 '15 at 1:44
• humm, let me think about for a while, I'm not fully decided on either side yet :P – glampert Jul 17 '15 at 1:47
• IMO if you exclude template-meta-programming (which should not be hyphenated btw) all that's left is implementations differences. I mean, the implementations differences are often significant, but ... – o11c Jul 17 '15 at 1:48
• @glampert Based on that link, I think synonimization is right. For example, Swift generics don't require you to specify a class or protocol (but you can). – nhgrif Jul 17 '15 at 1:54
• Yep, like I said, it is the same overall concept, so from that standpoint, they could be merged, however, if you look into the questions tagged with template, the majority seems to be c++, while generics is a mix of mainly Java and C#. Should those be mixed together? I don't know... – glampert Jul 17 '15 at 2:03
• As far as I can tell, "generics" is basically just Java's version of C++'s "template". – janos Jul 18 '15 at 16:13

## No.

Templates and Generics, though similar enough in some ways, are different enough in other ways to the point where a person expert in one will have little or no valuable insight on the other. A person who follows will not likely follow (and vice versa). This makes it different from other language-agnostic tags like , etc...

Tags have two purposes - a broad classification of questions, but also as landmarks that users use to find questions to answer. Merging these tags will make life "worse" for people who follow them, not better, and will add little, or no value for people asking questions either.

So, no, do not mix these two.

• So which tag should we use for Rust "generics", which act like C++ templates? – o11c Jul 18 '15 at 22:39
• @o11c If the documentation calls them generics, use generics. If it calls them templates, use templates. Don't mix them. – Mast Jul 19 '15 at 7:33
• @Mast Okay, so the tag generics gets used for (quoting) "similar enough in some ways, are different enough in other ways to the point where a person expert in one will have little or no valuable insight on the other". Gotcha. – o11c Jul 19 '15 at 20:27
• Keep in mind that template should not be used for template-meta-programming, which I think covers all the things that generics can't do. – o11c Jul 19 '15 at 20:28

From a technical standpoint, if we look into the way C++ templates are implemented vs how Java generics are implemented, there is a big difference. C# generics are implemented in a way more similar to C++ templates, but there are a few differences as well. Certainly there's more, but these are the languages I know about.

From a semantic standpoint, my understanding is that both templates and generics represent the same concept of type generic programming. From this perspective, then yes, the words are synonyms.

Now from a cultural standpoint, I don't recall ever hearing a C++ programmer use the term generics to talk about templates, so I'm not sure if mixing both terminologies is a good idea due to the historial meaning of the word template in the C++ community.

So in the end, all that beating around the bush is my way of saying that I'm not sure :P. It seems to me that I can go both ways just as well.

• For what it's worth, you'll never hear an iOS developer talking about [hash-maps], but [dictionary] has been made a synonym of [hash-map]. Thanks for your input. – nhgrif Jul 17 '15 at 4:02