Live data from Hacker News

Go 1.21 Release Candidate

go.dev

91–100 of 236 posts

Re: Go 1.21 Release Candidate

#91
post #9

Huh, I'm glad to see generic Min/Max functions, but the fact that they're built-ins is a little odd to me. I would have expected them to put a generic math library into the stdlib instead. The fact the stdlib math package only works with float64s has always struck me as a poorly thought out decision.

What sort of use case do you see for non-float64 math operations in a Go application?

Re: Go 1.21 Release Candidate

#92

I'm a bit surprised that the slog package was added to the stdlib, but it does seem to use the API that I think is the most ergonomic across libraries I saw in Go (specifically, varargs for key values, and the ability to create subloggers using .With), so I guess it's nice most of the community will standardize around it. If all goes well, you won't have different libraries using different loggers anymore, in some no…

I think it's pretty exciting. Don't have to keep using regex or weird parsing to get the key values from logs that one wants.

Also a bit surprised how fast it was added to the stdlib, but perhaps there was a lot more consensus on the api compared to other golang proposals.

Re: Go 1.21 Release Candidate

#93
post #37

I wonder if the new stdlib logger is featured enough to get rid of logrus/zerolog.

I'm wondering the same. Anyone already played for some time with the pkg?

I've been using it for a few weeks now. Overall pretty happy with it. Has good default API, and can be basically arbitrarily extended as needed. We even have a custom handler implementation that allows us to assert on specific logs being emitted in our stress/fuzz testing.

Re: Go 1.21 Release Candidate

#95
really hope Go has something like MERN for node.js or Django for Python, so I can use it for ready-to-go backend framework. There are gin and echo etc, just not as widely adopted as MERN or Django.

in some of my use cases, I need make sure source code is fully protected, neither Node nor Django can do that well, Go will be perfect as it is compiled, however there is nothing like MERN or Django in Go(yet). Another option will be Java, but I do not know Java.

Re: Go 1.21 Release Candidate

#96
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.

Clearing a container is usually a much simpler and faster operation than looping through all and removing them individually. That's not a question of tidying something up.

Re: Go 1.21 Release Candidate

#97

> New built-in functions: min, max and clear. What a mistake.. reserved keywords are words I can no longer use for myself... Zig does it better by requiring a prefix @ for most their builtin needs

min and max are predeclared identifiers in the universe block, not reserved words. https://go.dev/ref/spec#Predeclared_identifiers

You can continue to declare your own entities with these names.

Re: Go 1.21 Release Candidate

#99
post #85

Earlier quoted context omitted.

What big thing are you expecting? Go is more of a stable language, a reliable and boring language for building software now that in ten years you can still maintain. Go isn't peaking, Go isn't an exciting or cool or hype language, it's just... there. And that's just fine. Too many languages just started borrowing features from others, saying "yes" to every suggestion, until they got out of control and all over the pl…

> ...generics took a long time because they wanted to understand the problem and not add more like what happened to Java Just out of curiosity, can anyone regale me with that history with Java's generics?

"type erasure" is the search term you're looking for.
Post reply on HN