3 ms·
How does Go statically type check collections, then? It seems like a pretty common, desirable use-case to me. I could understand not missing this if you're com
by jjoonathan 8y ago
How does Go statically type check collections, then? It seems like a pretty common, desirable use-case to me.
I could understand not missing this if you're coming from a dynamically typed environment, but understand that many people aren't.
- marcrosoft 8y agoUmm don't? Why are you iterating over unknown types?
- jjoonathan 8y agoRight back atcha.
- anonymoushn 8y agoGo can statically type check hash maps, arrays, and channels. If you want some other container type it must be written with a concrete element type in mind.
- jjoonathan 8y agoWait, really? The language designers gave themselves (effective) generics and then kicked down the ladder afterwards so that other container implementers couldn't follow? That's hilarious.
- ckocagil 8y agoYes. And yes.
- skj 8y agoWhy does it need to be fair? Serious question.
- jjoonathan 8y agoIt doesn't, obviously, it's just hypocritical and patronizing.
- symlock 8y agoWhat do you mean?
- jjoonathan 8y agovoid do_stuff(Integer[] integers) { .... } do_stuff(new String[]{"1", "2", "3"}) Compiler: whoops, you passed an array of strings when the API called for an array of integers.