Excessive nil pointer checks in Go
konradreiche.com
Excessive nil pointer checks in Go
1–10 of 116 posts
Re: Excessive nil pointer checks in Go
#2Re: Excessive nil pointer checks in Go
#3Re: Excessive nil pointer checks in Go
#4Re: Excessive nil pointer checks in Go
#5What about wrapping nil in a Maybe or Option type?
Re: Excessive nil pointer checks in Go
#6What about wrapping nil in a Maybe or Option type?
Option types just forces you to do the check, but doesn't remove the need for it.
Now that we have generic types, a NonNullable intrinsic type seems doable...
Re: Excessive nil pointer checks in Go
#7What about wrapping nil in a Maybe or Option type?
In this case, the missing piece in Go is the NonNullable hint. That would make it clear that null checks aren't needed, enforceable by the type system, and lintable. Option types just forces you to do the check, but doesn't remove the need for it. Now that we have generic types, a NonNullable intrinsic type seems doable...
Re: Excessive nil pointer checks in Go
#8Re: Excessive nil pointer checks in Go
#9Re: Excessive nil pointer checks in Go
#10What about wrapping nil in a Maybe or Option type?
In this case, the missing piece in Go is the NonNullable hint. That would make it clear that null checks aren't needed, enforceable by the type system, and lintable. Option types just forces you to do the check, but doesn't remove the need for it. Now that we have generic types, a NonNullable intrinsic type seems doable...