Hacker News new | past | comments | ask | show | jobs | submit login

there's nothing magic about generics. every time you make a channel or a map in go, you're using a generic function even if go people don't want you to call it that.

there's nothing magic about exceptions, too, it's that it's harder than necessary to use them correctly and that's why it's not as big of a deal to not have them in go - as evidenced by this thread.




I can sympathize with the dislike of exceptions. I very much prefer Rust's error handling model (return Result<T, Err>)

The fact that Go has had this much success without generics is mind-boggling to me.


Because Google.

Go is quite similar to Limbo, by some of the same authors, how much success did it have outside AT&T?


> Because Google.

No, it was adopted quickly because it's a simple, script-like language producing static binaries that didn't require any runtime, highly portable with built-in cross-compilation, requires very little resources, is able to perform pretty damn good and has an extensive standard library (although not perfect) supporting many modern technologies.

That are a lot of boxes it ticks off. I remember wanting to start hobby projects with friends where the end-result would preferably be a native binary, and the limit was that I was the only-one with a C/C++ background. Now anyone with some scripting background can pick up Go in a few days, without having to worry too much about a build system, portability, cpu architectures, performance, memory leaks, ...

Sure, Google was the initial push, but it only really took off once projects like Docker showed it's potential.


Limbo was not freely available.


Vita Nuova has it on an open source license since March 2000, which means it has been freely available for the last 17 years!


Yes, go has generics, or at least parameterized types, used for channels and maps. What it doesn't have are user-defined parameterized types.


I think that's the point really. I think the average programmer like using generics, but rarely builds their own code with them. I've used them from time to time to great effect, but the use cases were pretty isolated. Maybe that makes me average? /shrug


Curious, how is a map generic?


If you declare a map[string]int, Go will guarantee that keys are always strings and values are always ints, and it's a compile-time error to pass it to someone expecting a map[string]float64. Without generics, the only way to do that is to generate and compile a MapStringInt struct and a MapStringFloat64 struct and a...




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: