Live data from Hacker News

Go 1.21 Release Candidate

go.dev

21–30 of 236 posts

Re: Go 1.21 Release Candidate

#21

Seems like a really substantial release to me. The new built in functions min, max, and clear are a bit surprising, even having followed the discussions around them. The perf improvements seem pretty great, I’m sure those will get much love here. Personally, I’m most excited about log/slog and the experimental fix to loop variable shadowing. I’ve never worked in a language with a sane logging ecosystem, so I think sl…

Am I reading it correctly that `clear` does different things for maps and slices? Why doesn't it remove all the items from the slice like it does with the map, or set the values in the map to the zero value like it does for slices? That seems like an easy thing to get tripped up on

Re: Go 1.21 Release Candidate

#23
Nice, my push for actually using the sha256 instructions on amd64 finally got released. 3x-4x increase in hash speed on most x86 which is really nice for content addressable storage use cases like handling container images.

Re: Go 1.21 Release Candidate

#25
post #18

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. Is this a result of the generics work that makes implementation easier vs. the extra work of making a new "magic" function (like "make", etc.)?

It might also be that they’ve worked their way down the priority list and are getting to these features that are largely just to tidy up code.

Re: Go 1.21 Release Candidate

#27

Nice, my push for actually using the sha256 instructions on amd64 finally got released. 3x-4x increase in hash speed on most x86 which is really nice for content addressable storage use cases like handling container images.

Got a link to the PR? Curious to see how this is implemented.

Re: Go 1.21 Release Candidate

#28
post #18

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. Is this a result of the generics work that makes implementation easier vs. the extra work of making a new "magic" function (like "make", etc.)?

That `clear` on a slice sets all values to their type's zero value is going to be extremely confusing especially coming from other languages (Rust, C#, C++, Java, ...) where the same-named function is used on list-ish types to set their length to zero.

Doubly-so when `clear` on a map actually seems to follow the convention of removing all contained elements.

Re: Go 1.21 Release Candidate

#29
post #12

I enjoy Go so much. It is almost perfect language for getting things done, but I still can't understand some design choices. Does someone knows why Go uses env variables (like GOOS and GOARCH) instead command line arguments?

I assume so that it can be sticky across invocations and is easy enough to debug using `go env`

Re: Go 1.21 Release Candidate

#30
post #18

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. Is this a result of the generics work that makes implementation easier vs. the extra work of making a new "magic" function (like "make", etc.)?

One aspect of this is that it was formerly impossible to delete NaNs from a map[float64]T, unless you had the nan already.
Post reply on HN