Live data from Hacker News

Go 1.18

go.dev

251–260 of 614 posts

Re: Go 1.18

#251

This is very exciting! Generics will be helpful for some, I'm sure, but my reading of the winds is that people will find other idiosyncracies of Go to latch onto and complain about. It seems to me the next object of hatred is the lack of sum types. I would like to understand a bit more about where a lot of the Go criticism comes from. Of course some amount of it comes from direct frustrations people have with the lan…

> Generics will be helpful for some, I'm sure, but my reading of the winds is that people will find other idiosyncracies of Go to latch onto and complain about. It seems to me the next object of hatred is the lack of sum types. I'm a big Go proponent, and I'm pretty "meh" on generics. They'll make some code easier to read and write, but they'll make a lot of code a lot harder to read (because contrary to popular beli…

[deleted]

Re: Go 1.18

#252

Great to see this! Generics will drastically improve datastructure libraries. That said, for people worrying about overcomplication, fortunately methods can't have type parameters. That means ergonomic monads are not possible to implement, and we'll most probably not see the whole functional story play out in Go.

> That means ergonomic monads are not possible to implement

This is a good thing?

Re: Go 1.18

#253
post #235

Earlier quoted context omitted.

There’s a « replace » directive in go.mod.

Yeah I know, but it's suboptimal. If you use it your module cannot be "go install" lled, and it doesn't work for libraries

Replace in go.mod breaks `go install`?

Re: Go 1.18

#254

Generics is the big news, but the fuzzing support is amazing too. I added a fuzz test to an app I have in about 5 minutes. It was no harder than adding a normal test. I expect to see a huge boon in users of fuzzing techniques which will benefit projects across the board.

Nobody at my work has even heard of fuzzing and thought I was making it up. I'm glad senior SWEs are paid so much to keep up with the industry. /s

Re: Go 1.18

#255
post #58

Tip: If you've only heard about generics, make sure to check out about fuzzing (*testing.F)!

Any idea why they have such a low byte budget? testing.Fuzz would be so much more readable. I'll accept test.Fuzz if 9 characters is the limit for any compound identifier. Is this sort of single letter class naming common in the standard library?

Not in the standard library in general, but in the testing package it's the convention. There's testing.B, testing.M, testing.T, and testing.F, and *testing.TB.

https://pkg.go.dev/testing#pkg-types

Re: Go 1.18

#256
post #166

Earlier quoted context omitted.

And the stupidest of all: defer is function-scoped, not block.

I don't like calling any of these things stupid. They're tradeoffs, and I can respect why they were made.

I would agree with you in the general case, but I yet to hear any sort of sane explanation for why it is the way - and it is not like a typical tradeoff where something arguably worse would have been chosen otherwise, it is just a small semantic change to a keyword.

But its effect is huge, e.g. the prototypical usage of the keyword would be to unlock mutexes, but it is simply a huge footgun, see: https://news.ycombinator.com/item?id=30253426

Re: Go 1.18

#257

Earlier quoted context omitted.

>> generics reduce complication That goes against the definition of the word complication. To complicate something is to combine and intertwine it with other concerns. To fold them together is to complicate them. To generify a function is to complicate it with the ability to accept multiple types rather than just one. There are totally great use cases for generics but all the cases I’ve seen are in library code not i…

As a general rule, if you're referencing the dictionary definition of a word to make your point, you're just playing semantic games. You know what people also find complicated? Hundreds of lines code being repeated with superficial edits because of golang's lack of ability to abstract higher-level ideas. It's a stupid toy example, but for a very large number of people nums.take(20).select(&:odd).reduce(&:+) is less c…

should be == 0?

I don't like the Ruby example myself.

Re: Go 1.18

#258
post #253

Earlier quoted context omitted.

Yeah I know, but it's suboptimal. If you use it your module cannot be "go install" lled, and it doesn't work for libraries

Replace in go.mod breaks `go install`?

Oh yeah, this used to work but some go version ago it stopped working. See https://github.com/golang/go/issues/44840

Re: Go 1.18

#259
post #58

Tip: If you've only heard about generics, make sure to check out about fuzzing (*testing.F)!

Any idea why they have such a low byte budget? testing.Fuzz would be so much more readable. I'll accept test.Fuzz if 9 characters is the limit for any compound identifier. Is this sort of single letter class naming common in the standard library?

it's super common everywhere, also in third party libraries (`bson.M` is what exactly?). it's one of the reasons that makes go a very displeasing language to work with.

Re: Go 1.18

#260

My favorite feature is a tiny, couple line bug fix that I pushed hard to get included during the feature freeze. Full details here, but a summary is below: https://github.com/golang/go/issues/51127 For the past ~8 years, many hundreds of people reported on GitHub - and likely many multiples more have encountered and not reported - a program that didn't work with the error "cannot unmarshal DNS..." This error seems to…

I wish I had your time and effort to be able to fix the issues of split DNS in macOS being broken unless using cgo. https://github.com/golang/go/issues/12524 This has been an open issue since 2015. It's a pain because every single last tool using go cross compilation fails to use the proper DNS resolver and thereby doesn't work when using work VPN's. This is tools like: kubectl, vault, concourse (fly), and many other…

Very interesting and very helpful. TLD-specific resolvers on Mac not working is the missing piece I needed to understand why our team builds binaries on Mac and cross-compiles to the other two.
Post reply on HN