20 points · by beliu · 11y ago · 15 comments
Oh, it's clear by now. Though "essential" is a weasel word -- in a way nothing is essential in the sense you can do it all with assembler too.
>Generics are incredibly complex in both semantics and implementation. There are considerable trade-offs to consider, such as do you want a larger binary vs. slower binary vs. larger source code.
Unless I use them, I get none of those downsides. And when I need them, I now have to implement support for my types manually, which results in larger source code anyway.
And "larger source code" hasn't been a problem since 1980.
>Language features without competition: goroutines, interfaces, defer (now in Swift)
Those have been around in several other languages... Hardly "without competition".
>Tools without competition: fast compiler
It's fast because it's not doing much. And there are several compilers that are fast too.
The null compiler (which produces nothing) is even faster, but 1000s of orders of magnitude.
As you can see I'm not in favor of the choices they made to make the compiler fast.
It's not much of a feat -- it's like writing a 8-bit era like game, and bragging that it gets 2000 fps performance.
First, after 60 fps it's dimminishing returns anyway, and second, yes, but at what cost?
I think eventually it'll be complete, with only the occasional maintenance patch.
Edit: On reflection, "traits" is probably the wrong word. C++ has a word for this, but I'm drawing a blank at the moment.
It's the same end result, but without the speed and the type checking of proper Generics.
(Assuming you mean "empty interfaces" (interface{}). Else, regular interfaces are not the same thing as Generics.
>On reflection, "traits" is probably the wrong word. C++ has a word for this, but I'm drawing a blank at the moment.
Templates?
Now, in Go, you don't have generics. But you can have a sort function that takes a type (interface) that means "something that has a less-than function", and because of the way Go does OO, anything that has that function works.
This doesn't get Go to the point of having templates that will take any type whatsoever (unless you use empty interfaces).
I feel like I'm still using the wrong word in one or two places. But I hope this is more clear than my previous comment.
Niklaus Sweet, fucking seriously?