Excessive nil pointer checks in Go

(konradreiche.com)

7 points | by ingve 2 days ago ago

3 comments

  • lenkite an hour ago

    Delegate all `nil` and bad input checks to a validation framework and use it in all your constructor functions.

  • turtleyacht 2 days ago

    What about wrapping nil in a Maybe or Option type?

  • bediger4000 2 days ago

    This is good advice for humans: they can quantify to decide "too many nil checks" or not. But it's not good for agentic coding, which we're entering the age of. Although agents are the worst they'll ever be right now, they're never going to be great at quantifying too many nil checks. I think we'll have to get used to far more nil checks than even bad programmers put in. But that doesn't matter to agents, they've got infinite attention spans, no cognitive bias and large working memories. Sonn we'll see no nil checks.