4 ms·
I don’t need to spend any more time with static typed languages that avoid generics. I wrote Go for several years, tried to love the simplicity, then tried to l
by jitl 5y ago
I don’t need to spend any more time with static typed languages that avoid generics. I wrote Go for several years, tried to love the simplicity, then tried to love code generation. Then I gave up. I don’t need to repeat that experience.
- raviqqe42 5y agoI agree. It's not for everyone but there are many different kinds of developers. If you are and can hire smart people who can use generics without introducing extra tech debt and complexity, I definitely recommend the ones with generics like Rust and Haskell. But the problem is that I'm not smart enough.
- techsin101 5y agoAs JS developer it took me sometimes realizing the importance of generics, as by default in JS problems it solves doesn't exist. Funny how typed language advocates want automatic casting in the end after all.
- bitmapper 5y agoSince when are generics automatic casting?
- techsin101 5y agoit's not but it's essentially the same practically speaking -- you get type A|B|C you write code to interact with it in just one way. Either by casting, or generics. weakly typed language do that for you, but they are looked down on.
- myoon 5y agoI think you're missing the key point of statically typed languages, that the compiler catches errors for you. Generics are valuable because it allows users to write "generic" reusable functions that are still checked by the compiler. Of course dynamically-typed languages can do this easily, but that's not the point.
- chakkepolja 5y agoBlub 101
- tempodox 5y agoGenerics are the polar opposites of automatic casting. They exist so you don't have to shoehorn one argument type into another. JS isn't exactly the best environment to understand this. Ideally, use a compiler language that can show you the generated assembly (`gcc -S ...` with C++ for instance). Then you can see first-hand how type-specific implementations of a generic function look like.
- Daegalus 5y agoI'm in the same boat. I still enjoy writing Go, it's my primary language but adding generics is something I have been looking forward to for a long time. there is so much code that could be made simpler or deduplicated with generics.