We have a very large Go codebase here at Stream and not having generics is just not really as big of an issue as you think it is. There are plenty of work arounds if you get used to not having generics in the language. The fast compile times of Go are amazing. I was doing some Kotlin a few weeks ago and the difference is crazy. Go: Install deps, compile everything done in 5s. Doing the same in Kotlin, laptop freezes,…
What is the workaround for having a nice ORM library?
A Proposal for Adding Generics to Go
91–100 of 273 posts
Re: A Proposal for Adding Generics to Go
#92Basically, I want fast statically typed python with better package management. Or other way to put it, I want Go with classic OOP and Exceptions.
Re: A Proposal for Adding Generics to Go
#93Earlier quoted context omitted.
Generics aren't magic, and they aren't Turing complete, like C++ templates. They're just a way to avoid copy-pasting code. Having `Set ` and `Set ` is far more readable than `class FooSet` and `class BarSet`, where the code is exactly the same aside from a search-and-replace. You also run into issues where someone finds a bug in `FooSet`, but doesn't know `BarSet` exists, and forgets to patch both. Now, you have two…
Can you give a real world example that couldn't be solved with interfaces? The only real cases I can see is creating new data structures, (for instance if you wanted to create your own map type).
Of course not. Go is Turing complete, and generics do not make it Turing-completer (whatever that may mean)
The question isn’t about what can or cannot be done, but about expressiveness, ease of understanding for humans versus language size (even if you have plenty of disk and RAM, That correlates with buggyness of the compiler) and compilation speed.
Re: A Proposal for Adding Generics to Go
#94Earlier quoted context omitted.
Actually not that much, I remember 2 very different proposals, including this one. The previous one was confusing as F and the antithesis of the simplicity Go claims it abides by. It felt very much like a plot to add generics without ever using the word generics anywhere and looking too much like Java/C#/... The current proposal is basically what you'd expect from generics in a programming language, but a bit more li…
I'm curious what's the issue with go routine and what kind of fix ADA bring?
Re: A Proposal for Adding Generics to Go
#95Earlier quoted context omitted.
I like Go, but I too in the meantime have dipped my toes into Rust and it's just so much better without being that much more complex. The learning curve is real but quite a bit overstated I think.
I'm taking my second crack at learning Rust and I have to say I've made a lot more progress this second attempt. It could be just giving things time to stew in my head, but I really think it's because I'm using rust-analyzer with vscode and before I was using RLS. Rust-analyzer is a much richer experience and its informative error messages and suggestions lessens the learning-curve drastically.
I think one think that could seriously be improved is high-quality explanations of Rc, RefCell, etc, and where and why they are used.
I have found myself piecing together explanations from various books, Reddit threads, etc just to try to wrap around these.
Re: A Proposal for Adding Generics to Go
#96Earlier quoted context omitted.
isn't generic Sets easily implemented with map being already generic?
Yes and that's probably why there is no set in the go std lib. You just can use struct{}{} as (empty) value in a map.
[0]: https://rust-lang.github.io/hashbrown/hashbrown/hash_set/ind...
Re: A Proposal for Adding Generics to Go
#97Side tracking a bit: I wish there was a popular programming language like Go with rust-like package manager, Python style syntax and ability to hack, compilable, classic (classes, methods), and fast. Or I wish Go had classic OOP and raise Exception methods. Basically, I want fast statically typed python with better package management. Or other way to put it, I want Go with classic OOP and Exceptions.
Re: A Proposal for Adding Generics to Go
#98We have a very large Go codebase here at Stream and not having generics is just not really as big of an issue as you think it is. There are plenty of work arounds if you get used to not having generics in the language. The fast compile times of Go are amazing. I was doing some Kotlin a few weeks ago and the difference is crazy. Go: Install deps, compile everything done in 5s. Doing the same in Kotlin, laptop freezes,…
That's exactly what generics are supposed to solve! ;)
No, but seriously, I'll be interested to see if they can pull off maintaining the compiler performance while adding support for this new feature. I've had to hand-write a lot of code that I'm excited about a generics solution automating, but automation can have a price, you're exactly right. I've worked on a C++ codebase before that couldn't physically compile on my machine because it blew stack on template instantiation recursions (issue never noticed because the original developer had a better machine).
Re: A Proposal for Adding Generics to Go
#99We have a very large Go codebase here at Stream and not having generics is just not really as big of an issue as you think it is. There are plenty of work arounds if you get used to not having generics in the language. The fast compile times of Go are amazing. I was doing some Kotlin a few weeks ago and the difference is crazy. Go: Install deps, compile everything done in 5s. Doing the same in Kotlin, laptop freezes,…
The answer is: A lot.
Re: A Proposal for Adding Generics to Go
#100Earlier quoted context omitted.
Can you give a real world example that couldn't be solved with interfaces? The only real cases I can see is creating new data structures, (for instance if you wanted to create your own map type).
> The only real cases I can see is creating new data structures Half of programming is creating new data structures. The other half is tranformations (e.g. map, filter, reduce, min, max, etc) which also benefit from being generic.
I can see it for your transformations, but I have seldom seen cases where generics would really help (usually we're talking about comparing complex structure types that will need custom code anyway).