Live data from Hacker News

How generics are implemented in Go 1.18

github.com

211–220 of 228 posts

Re: How generics are implemented in Go 1.18

#211
post #187

Earlier quoted context omitted.

You clearly have no idea what Rust is for, or who the target audience is. Application developers do not need a non-GCed language, and anyone who argues for the added complexity and noise (because Rust makes it so easy you'll say) is actually just looking for something cool to learn and push at the office. I get it, you don't want to write Go, it's too simple for the 1%er programmers. I've been a kernel developer for…

You clearly don't have any idea who I am, or my opinions on Rust. Since I feel like educating you, > Nothing really, Rust's killer application are domains where using a language with automatic memory management and support for value types isn't an option, trying to use it elsewhere, while possible is sacrificing productivity. https://news.ycombinator.com/item?id=30391431 That doesn't change the fact that many relevan…

You fail to address the core point of the parent: a no-GC language like Rust does not compete in the same space as Go.

You either need the low overhead of no-GC or you don't. If you don't, choosing Rust is a mistake.

---

As for your examples, I'm familiar with the Discord rewrite and I looked up the Linkerd2 proxy. Both programs are low-level services that are designed to handle as much load as possible, so yeah they should be written in a non-GC language.

---

> Linkerd2 proxy was written in Rust, despite Linkerd 2 being written in Go.

From [2]:

"The decision to use Rust came down to several factors. First, a service mesh proxy has some pretty stringent requirements: because it’s deployed as a sidecar on a per-pod basis, it has to have as small a memory and CPU footprint as possible. Because most or all of the application’s network traffic flows through the proxy, it needs to have minimal latency overhead, especially worst-case tail latency."

This should obviously be written in a non-GC'd language.

---

> The famous rewrite from Go into Rust done by Discord for their microservices.

> microservice**s**

Nope, just one microservice; at least according to the article ([1]).

From the article:

"In order to get quick atomic counter updates, each Read States server has a Least Recently Used (LRU) cache of Read States. There are millions of Users in each cache. There are tens of millions of Read States in each cache. There are hundreds of thousands of cache updates per second."

So again, the same exact story - stringent latency/speed requirements.

---

[1]: https://blog.discord.com/why-discord-is-switching-from-go-to...

[2]: https://linkerd.io/2020/07/23/under-the-hood-of-linkerds-sta...

Re: How generics are implemented in Go 1.18

#212

Earlier quoted context omitted.

Considering it was written by a Turing award winner and other members of Bell Labs and Google, who not only shaped modern day computing but have been doing so for the literal 50 years you referenced, maybe you should consider that the reason that Go is popular and used in many settings is because it's good, and you're the one who is A) suffering from a bad case of Dunning–Kruger B) Have yet to learn the lessons that…

"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt." – Rob Pike

How many times is this gonna get reposted as some sort of gotcha? He's right, and having to deal with juniors or large teams with varying competence isn't unique to Google. I've met many devs who praise Java for how simple it is to parse through for people of all experience levels (once you get used to the verbosity). In fact, two of Java's founding principles was that it had to be simple and familiar. Yet I don't see anyone pretending that's a bad thing.

Go has the same goals, just a different approach. Java is too verbose, Go takes the simplicity approach too far sometimes. Neither are perfect but they're definitely useful and worth considering for many projects. The fact that it was made with juniors in mind is a plus.

Re: How generics are implemented in Go 1.18

#213
post #128

Earlier quoted context omitted.

AOT compiler; single binary; standard library and package ecosystem well suited for a subset of programming tasks, while being much lightweight and less verbose than Java / C#. Would not pick Go to make a website. But it's probably best tool to make a simple HTTP server or command line tool that deals with files or network.

Java has AOT compilers since 2000, they just weren't free beer. .NET was released with AOT compiler, although it only did dynamic linking (NGEN). Mono always supported AOT compilation, just like the C# dialects for Singularity, Midori, and .NET Native for Windows 10 UWP.

> Java has AOT compilers since 2000, they just weren't free beer.

Commercial offerings are quite obviously not comparable to free ones.

Seems like Java can't really do AOT, even in 2022: https://news.ycombinator.com/item?id=30444454

Now, I say "really", because this is not about whether you can technically compile Java AOT or not. It's about the level of support - in Go AOT compilation is first-class. In Java, you're stuck looking through multiple second party options, some paid, some with caveats, bugs, etc.

First-class vs second-class support makes a massive difference.

As an example, this is like seeing "Go's advantage over java is its autoformatter - gofmt" and responding "Well, Java has autoformatters too!". Technically true, but irrelevant - in the real world, gofmt is used on 90%+ Go projects. The few Java projects that do use autoformatting each use a different formatter with different sets of rules. First-class vs second-class.

Re: How generics are implemented in Go 1.18

#214
post #212

Earlier quoted context omitted.

"The key point here is our programmers are Googlers, they’re not researchers. They’re typically, fairly young, fresh out of school, probably learned Java, maybe learned C or C++, probably learned Python. They’re not capable of understanding a brilliant language but we want to use them to build good software. So, the language that we give them has to be easy for them to understand and easy to adopt." – Rob Pike

How many times is this gonna get reposted as some sort of gotcha? He's right, and having to deal with juniors or large teams with varying competence isn't unique to Google. I've met many devs who praise Java for how simple it is to parse through for people of all experience levels (once you get used to the verbosity). In fact, two of Java's founding principles was that it had to be simple and familiar. Yet I don't se…

> having to deal with juniors or large teams with varying competence isn't unique to Google.

It's good for "juniors" but not yourself? Lmao.

No one can praise Go without speaking in the third person.

Re: How generics are implemented in Go 1.18

#215
post #13

Earlier quoted context omitted.

Isn't that solved with c++ modules [1]? [1] https://en.cppreference.com/w/cpp/language/modules

Yes, with VC++ offering the best experience currently.

I am confused. Why was this downvoted? Is GCC and Clang doing better? (Or another C++ compiler?)

Re: How generics are implemented in Go 1.18

#216
post #121

Earlier quoted context omitted.

Quoted post unavailable.

I‘m sure there are better reasons for people liking Go other than what you described. This reads like a general dismissal.

I don't hate go for the language itself. I understand the point of using go, especially if you have a company with hundreds or thousands of software engineer. It is really good for building microservices, because to me the learning curve is not steep hence everybody who just learn it, could already make contributions to the codebase.

what I don't understand are the fans who are really trying to overglorify go as "language of the future" that could be a C replacement.

Re: How generics are implemented in Go 1.18

#217
post #211
post #187

Earlier quoted context omitted.

You clearly don't have any idea who I am, or my opinions on Rust. Since I feel like educating you, > Nothing really, Rust's killer application are domains where using a language with automatic memory management and support for value types isn't an option, trying to use it elsewhere, while possible is sacrificing productivity. https://news.ycombinator.com/item?id=30391431 That doesn't change the fact that many relevan…

You fail to address the core point of the parent: a no-GC language like Rust does not compete in the same space as Go. You either need the low overhead of no-GC or you don't. If you don't, choosing Rust is a mistake. --- As for your examples, I'm familiar with the Discord rewrite and I looked up the Linkerd2 proxy. Both programs are low-level services that are designed to handle as much load as possible, so yeah they…

The languages compete on whatever people decide to use them for.

People also use JavaScript, Python and Ruby for use cases that ask for AOT compiled languages

Thankfully no one is going to jail for using a language where it doesn't belong.

Re: How generics are implemented in Go 1.18

#218
post #191
post #187

Earlier quoted context omitted.

You clearly don't have any idea who I am, or my opinions on Rust. Since I feel like educating you, > Nothing really, Rust's killer application are domains where using a language with automatic memory management and support for value types isn't an option, trying to use it elsewhere, while possible is sacrificing productivity. https://news.ycombinator.com/item?id=30391431 That doesn't change the fact that many relevan…

>You clearly don't have any idea who I am Why would anyone here have any idea who you are? Your username is not informative, and you don't say who you are in your profile. That's perfectly fine, of course, but you can't then expect people to recognize you as being a particular individual.

I don't hide behind nicks, my online life is relatively easy to find, and besides the tone should have started in a different way than "You clearly have no idea what Rust is for".

Re: How generics are implemented in Go 1.18

#219
post #187

Earlier quoted context omitted.

You clearly don't have any idea who I am, or my opinions on Rust. Since I feel like educating you, > Nothing really, Rust's killer application are domains where using a language with automatic memory management and support for value types isn't an option, trying to use it elsewhere, while possible is sacrificing productivity. https://news.ycombinator.com/item?id=30391431 That doesn't change the fact that many relevan…

Please don't use Discord as an example. They are proprietary and quite hostile to its users through its data and metadata hoarding practices.

Plenty of FOSS projects don't share your opinion on where to host their forums.

Re: How generics are implemented in Go 1.18

#220
post #130

Earlier quoted context omitted.

We use go in an embedded Linux environment. I do C#for web stuff and it would never cross my mind to do c# in an armv7 Raspberry. Also what about cross compilation? The c# runtime is not easily available to use in embedded devices at least that i know of. With go you just set it to compile statically and set the arch target. I can deploy it as a single binary. Love it after years of maintaining cross tool chains.

Here to blow your mind, https://www.wildernesslabs.co/

Wow impressed indeed. Especially the esp targeting. Is there some intermediate compilation from c# to c or a compiler backend was created from scratch?
Post reply on HN