(computing, programming) The use of templates, etc., to create generic source code that can be used in many situations.
generics
Definition, parts of speech, synonyms, and sentence examples for generics.
Editorial note
An option would be to write a super-set of Go with generics that would compile to Go code.
Quick take
(computing, programming) The use of templates, etc., to create generic source code that can be used in many situations.
Meaning at a glance
The clearest senses and uses of generics gathered in one view.
Definitions
Core meanings and parts of speech for generics.
noun
(computing, programming) The use of templates, etc., to create generic source code that can be used in many situations.
Example sentences
An option would be to write a super-set of Go with generics that would compile to Go code.
I still miss generics, and it may be that the particular kinds of programming I do mean I miss them less than others.
Any generics solution has to have fast runtime, because they need to replace the builtin parametric slices and maps.
Russ Cox said this year that generics aren't left out because of political reasons or design choice.
One would have to implement generics, then spend several programmer-years tuning the compiler over various programs, compilers are complex machines.
These may add new features to the table, eg generics or union types or goroutines.
In practice, I don't think a generics language feature that captures how I program in Go is possible.
But I do think the former problem has little to do with generics as a language feature.
And they would be widely used, any good generics solution would have to replace maps and slices, and would permeate the standard library.
Achieving generic behaviour with interface and reflection is much more consistent than generics as we know from other languages.
Kotlin does not reify generics, and like in Java, that's a good thing!
I suspect if a good generics implementation came along though that argument would get pushed aside.
Quote examples
You shifted the argument from "generics are either bad for compile time or bad for performance, and therefore bad for Go" to "I don't need generics".
Proper noun examples
Generics are just a way for the compiler to automate the work that a programmer would otherwise have to do.
If anything is far less featureful and Algol-like than most of the other languages that have found a way to fit Generics.
Generics would codegen exactly the same way as slices and maps do now.
Frequently asked questions
Short answers drawn from the clearest meanings and examples for this word.
How do you use generics in a sentence?
An option would be to write a super-set of Go with generics that would compile to Go code.
What does generics mean?
(computing, programming) The use of templates, etc., to create generic source code that can be used in many situations.
What part of speech is generics?
generics is commonly used as noun.