3 ms·
> No language is perfect, they are all trade offs. Uh, no they're actually not. A tradeoff means you accept some downside and get some upside in return. Initi
by kerkeslager 2y ago
> No language is perfect, they are all trade offs.
Uh, no they're actually not. A tradeoff means you accept some downside and get some upside in return.
Initially go was designed without generics. The tradeoff here was you got a single pass compiler which was faster. Well, actually, you could have a single-pass compiler with backpatching, but I get it, that's hard. It's a crap tradeoff, but okay, I can accept it's a tradeoff. And everybody at the time said, "Go doesn't need generics, they complicate the language." So we casted our nested types in and out of object and lost all type safety in that code, but hey, tradeoffs.
Except everyone kinda realized it was a crap tradeoff and so `go generate` was proposed as a solution. In a 1984-esque revision of the past, suddenly, having a second pass is okay! Never mind how important it was that go is a single-pass compiler. Nevermind that this is basically macros with all their pitfalls. But now we can generate 3 different versions of the parameterized type, one for each nested type, so we get type safety. 2 passes, macros, downsides, type safety, upside, and a pretty big upside at that.
But, here's the problem: now you have two different systems that are used for doing a lot of the same things that don't interoperate with each other very well. And that's not a tradeoff, because there's no upside. It's not "I don't like this but it works great for others" because it doesn't work great for anyone. It's not a tradeoff, it's a side effect of having chosen wrong the first time.
And... now Go has generics. And yeah, generics aren't really a tradeoff, they're just obviously pretty good. But, now we've got 3 different systems for doing a lot of the same things, which again, don't interoperate all that well with each other.
And here's the thing: from a language design perspective, this was extremely obvious that Go was going to need generics. Generics are pretty much the clearest win from the ML-family languages which had already made it into C# and Java by the time Go was conceived. It's absurd that this feature wasn't included in Go from the beginning.
- relistan 2y ago[flagged]
- guappa 2y agoReplying to that extremely well argumented comment with what is basically "NO I AM RIGHT!" is disrespectful.
- relistan 2y agolol replying “uh no, they’re actually not“ is disrespectful. And I did reply with an argument. The “extremely well reasoned” argument is about trade offs, despite the claim otherwise.
- kerkeslager 2y ago> You might not like the decision but trading flexibility for simplicity was a win for people learning the language. So I'm gathering you didn't read the entire post you're responding to. I fully agree that trading flexibility for simplicity is a tradeoff and never said otherwise. Sorry, buddy, this is an adult conversation and if you want to disagree with me you have to actually know what you're disagreeing with. Until you can be bothered to actually read the post and repeat back to me what I'm saying isn't a tradeoff, I'm not going to respond in any other way expect to restate the fact that your opinion on a post you haven't read is ignorant. So, what am I saying isn't a tradeoff?