Rejecting templates does not mean rejecting generics.
Rejecting templates does not mean rejecting generics.
This is provably incorrect.
The position held for many years by the language authors was[0]:
Generics may well be added at some point. We don't feel an
urgency for them, although we understand some programmers
do.
Generics are convenient but they come at a cost in
complexity in the type system and run-time. We haven't yet
found a design that gives value proportionate to the
complexity, although we continue to think about it.
Meanwhile, Go's built-in maps and slices, plus the ability
to use the empty interface to construct containers (with
explicit unboxing) mean in many cases it is possible to
write code that does what generics would enable, if less
smoothly.
Once the community could no longer be held back, the golang FAQ presented a very different position[1]: The Go 1.18 release added type parameters to the language.
This permits a form of polymorphic or generic programming.
0 - https://web.archive.org/web/20170102202940/http://golang.org...However, the original announcement makes the intent of the project clear: "Not yet", not "never". They were always planned to be accepted into Go. But not before an acceptable solution was found.
They have successfully been able to add major features such as generics without breaking 1.0 compatibility, and the trend is to continue than way. Well there is no major language feature in sight in fact.
Also major figures of the Go team (Russ, Ian, Rob, Ken) are gone.
> However, the original announcement makes the intent of the project clear: "Not yet", not "never". They were always planned to be accepted into Go.
This is an exceedingly charitable interpretation of the position held by at least one Go language designer (Rob Pike)[0]:
Notice that Robert said C was the starting point, not C++.
I'm not certain but I believe he meant C proper, especially
because Ken was there. But it's also true that, in the end,
we didn't really start from C. We built from scratch,
borrowing only minor things like operators and brace
brackets and a few common keywords.
In the end of course it came out quite different from
either C or C++. More different even than many realize. I
made a list of significant simplifications in Go over C and
C++:
...
- no templates
...
0 - https://commandcenter.blogspot.com/2012/06/less-is-exponenti...By run-time they mean compile-time? There shouldn't be a run-time penalty right?
Also, is there some measure of the additional compilation cost now that generics has been added?
That is a very selective quote which does not reflect the context I provided. So I will extract a selective quote which negates the above:
We haven't yet found a design that gives value
proportionate to the complexity ...