Re:Rust – A hard decision pays off
by rob74 on Wednesday August 24, 2022 @12:35PM
(#32581904)
I would say in this case it's more the API designers' fault than Go's fault. Looks like the Python API is operating at a higher abstraction level than the Go API - using the Python API you can just call a "macro" that does everything required, in Go you have to call each operation individually.
[ Parent
| on HN ]
Re:Rust – A hard decision pays off
by throwaway894345 on Wednesday August 24, 2022 @03:38PM
(#32584675)
It probably is Go's propensity to return error values whereas Python would bubble them up. Every action in Docker involves an I/O error at a minimum (since you're talking to the Docker daemon) so this is basically a worst-case scenario for error handling boilerplate. I don't doubt that Python is better for scripting in this case, but if you want to make an application that interfaces with Docker, Go is probably the better of the two (despite its boilerplate). In fact, I vaguely recall running into a bunch of Python-related bugs in docker-compose (it was at an old gig, and I haven't used docker-compose since, so I don't recall the particulars).
Still, creating a method that calls several other methods one after another is programming 101, so I refuse to entertain the though that creating a "containers.run" method similar to the one from the Python API is not possible in Go. The error handling is definitely not the culprit, you can check the error after each "subcommand" and return early with this error. The question is just, why didn't they do it?
Re:Rust – A hard decision pays off
by throwaway894345 on Friday August 26, 2022 @06:01PM
(#32613234)
Fair enough. I didn't look deeply at the API differences.
[dead]
Can you please avoid flamebait comments and make your substantive points thoughtfully, per https://news.ycombinator.com/newsguidelines.html? We don't want flamewars here. Programming language flamewars are especially tedious.
Re:Rust – A hard decision pays off
by AtNightWeCode on Wednesday August 24, 2022 @04:17PM
(#32585192)
Not sure what you are talking about. When I learned C back in the 90’s I was learned to handle every error state by hand. Exactly as you are expected to do in Go about 30 years later. And it sucks.
Maybe you can explain why Gophers are such whiners always crying about every freaking comment at any forum.
Can you please just not post like this? We're trying for a different kind of forum. I know it feels justified, and I'm sure it is, but the problem is the 'other' side always has its legitimate justifications too, and then everyone goes after each other and there's no more curious exchange.