4 ms·
> It is interesting to see them add things like the "clear" function for maps and slices after suggesting to simply loop and delete each key one at a time for s
by alex_lav 3y ago
> It is interesting to see them add things like the "clear" function for maps and slices after suggesting to simply loop and delete each key one at a time for so long.
Slowly walking back dogmatic positions is just how the Go team works.
I say this as a person that wrote Go full time for a handful of years.
- yencabulator 3y agoNo, it's because a use case was discovered that the for loop approach can't handle: NaN keys.
- alex_lav 3y agoI would argue Go's inability to manage NaN keys is irrelevant to the desire for "clear", in that I would argue that the NaN keys issue should be fixed _regardless_ of clear.
- stouset 3y agoIn my experience, that's exactly how this plays out every single time. Dev: Can we have a function to clear a map? Go: No, it's easy enough to write the 5 lines of code to just do it yourself every time. Dev: Okay, I don't see why I should have to write those 5 lines every time but fine. Isn't looping over everything going to be slower than just… having a function that can empty the internals? Go: We've implemented a compiler optimization to detect this and rewrite it to the faster code it would have been if it we were to implement it. Dev: Isn't that… way harder than just writing the method? Anyway, I noticed this solution doesn't actually always work because of this edge case. Go: Just handle the edge case every time then. Dev: That's the point. I can't. And around and around we go.
- alex_lav 3y agoI used to really like Go. Now that I don't work with it, I find that the further I go on without it, and with using other tools, the less and less I'd want to go back.
- yencabulator 3y agoYou're distorting the real story to fit your bias. Once the NaNn edge case was discovered, work to deal with that edge case was started.
- stouset 3y agoThis isn't remotely close to the first or even the tenth time I've seen this exact pattern play out. Finally there's some straw that forces the golang team to backpedal on a dogmatic position, but along the way there's dozens of comical defenses of the current state of things.
- philosopher1234 3y agoSo you say, with no actual reference. Maybe what you refer to happened in your head, and not in the real world.
- alex_lav 3y ago1. Generics 2. Clear Are the two already covered not enough?
- philosopher1234 3y agoI would like to see some content from the go team on generics or clear that fits your claim. Yes, there are many in the community who speak the way you suggest, but you don’t seem to know much about the Go teams pov.
- alex_lav 3y agohttps://news.ycombinator.com/item?id=23033183 https://news.ycombinator.com/item?id=23033183 A pretty apt write up. But I accept there’s probably not an amount of evidence to change your belief on Go’s dogmatism. And that’s okay! You like a language. That’s great!