News for hackers. Stuff that matters.
Re:Go proposal: Leave “if err != nil” alone? by convolvatron on Friday June 28, 2019 @01:29PM (#20306740)
its a bit of a drag. one niggling thing is that if, should it return a zero value along with the nil, means you have to be explicit about which zero value you are using..so refactoring function return types involves touching each of these.

not the end of the world, just sad. i do wish there were a type-unified zero value, or that "" and 0 were the same as nil, or some other solution here

Re:Go proposal: Leave “if err != nil” alone? by gigatexal on Friday June 28, 2019 @01:50PM (#20306978)
Yeah I have a function like this: return a *struct, err where a nil struct could be the result of a empty result from the database query that was just run or an error if the query had an error. And then the logic of that function is if a job was returned quit early (I’m preventing two things from happening on the DB side). But then there’s an annoying dance of checking if the job is nil and the error is nil that’s the happy path... you can see how this makes the just if the check err is nil usual path welcome