Earlier quoted context omitted.
Yeah, that's why Kubernetes had to develop code generators. So focused.
I wouldn't know, I don't use K8s. But I did write a code-generating ORM for a Go project and found it in a bunch of ways superior to the ORMs I'd used in dynamic languages, like ActiveRecord. And I've also worked with heavily parameterized Rust crates that kept 20 tabs open in my browser just trying to work my way through a couple function calls. Don't get me wrong, I'd take Rust generics over codegen 8 times out of…
Generics enabled by default in Go tip
361–370 of 378 posts
Re: Generics enabled by default in Go tip
#362Earlier quoted context omitted.
> I've learned that it's better to build many very very simple things and connect them. Not for any technical reasons, but because it allows other developers to quickly begin adding to and fixing your systems. You get to leverage the large amount of mediocre programmers when your systems are simple instead of looking for heros. It's definitely easier said than done though to make systems naturally intuitive and simpl…
Where did parent mention microservices? NSI (No Snark Intended). (edit) A parody about those: https://www.youtube.com/watch?v=y8OnoxKotPQ
> I try to extend the simplicity of golang all the way to the network architecture.
Re: Generics enabled by default in Go tip
#363Earlier quoted context omitted.
That example is essentially the most basic use of generics. There are much more complex examples that would support your argument better. What do you find confusing about that code?
I don’t find it confusing, but it is certainly more complex than a simple function call. I chose it because it is a basic usage of generics, to highlight that basic generics are more complex than basic function calls. A code base that makes heavy usage of generics takes more time to understand than one that doesn’t make heavy use of generics. The readability of go is what I love about it, amongst a few other things.
Re: Generics enabled by default in Go tip
#364Earlier quoted context omitted.
Kind of, now that typeof is going to be part of the language, that coupled with the preprocessor, does allow exactly that. Although in typical C fashion is a bit of kludge.
"coupled with the preprocessor" is a bit of a cop-out :-). Do you have a concrete example of what typeof would enable? Like a basic implementation of a vector type?
Here is an example, https://codereview.stackexchange.com/questions/101816/generi...
Re: Generics enabled by default in Go tip
#365Earlier quoted context omitted.
It isn't as if previous languages did not used code generators before generics were a thing on them.
Yea but, it has never been a particularly popular approach.
Borland BIDS 1.0 used such approach with pre-processor tricks, similar to many C projects do as well.
Java, well EMF was a common tool to generate such boilerplate, Velocity was another one.
Re: Generics enabled by default in Go tip
#366Earlier quoted context omitted.
I don’t find it confusing, but it is certainly more complex than a simple function call. I chose it because it is a basic usage of generics, to highlight that basic generics are more complex than basic function calls. A code base that makes heavy usage of generics takes more time to understand than one that doesn’t make heavy use of generics. The readability of go is what I love about it, amongst a few other things.
Without generics, you'd have N functions instead of 1. Are you sure N times the complexity of non-generic function is less than 1 time the complexity of a generic function?
Re: Generics enabled by default in Go tip
#367I like Go very much, a huge role plays its simplicity. In my career, I have been much more often bitten by having to deal with the complexity of a language then by not being able to do things, because a language feature is missing. That is, why I like Go so much. It strikes a great balance between important high-level features (GC, first class functions and closures) and still being a simple language (like Scheme is,…
I used to really hate Go's attitude to generics and type system features in general. I still do, but I appreciate that it's a matter of taste, and that different people have different tolerances for language complexity. People who like simplicity can use Go and people who like type systems can use Rust.
Re: Generics enabled by default in Go tip
#368Super excited for this. If you haven't checked out the latest proposal, here's an example of what Option/Result box types might look like (obviously not ready for release, just an experiment): https://go2goplay.golang.org/p/krvTH1_7lwX
Re: Generics enabled by default in Go tip
#369Earlier quoted context omitted.
Where did parent mention microservices? NSI (No Snark Intended). (edit) A parody about those: https://www.youtube.com/watch?v=y8OnoxKotPQ
I gathered the bit about microservices from > I try to extend the simplicity of golang all the way to the network architecture.
Re: Generics enabled by default in Go tip
#370Earlier quoted context omitted.
With Java, I didn't find it to be either a huge win or a major loss. And I still don't. It's basically window dressing that lets you avoid casts in certain obvious places where they weren't particularly problematic anyhow.
It's more than window dressing. A year ago I added correct generics to about 50 000 lines of Java, an old module in a bigger program. The change was mostly mechanical, removing casts and adding signatures. I found a few places where refactoring had left behind a wrong type cast. Production logs demonstrated actual crashes corresponding to these cast. There were bugs in the issue tracker, marked unresolvable.