Comment by skydhash
9 hours ago
I like go’s approach on having default value, which for struct is nil. I don’t think I’ve ever cared between null result and no result, as they’re semantically the same thing (what I’m looking for doesn’t exist)
9 hours ago
I like go’s approach on having default value, which for struct is nil. I don’t think I’ve ever cared between null result and no result, as they’re semantically the same thing (what I’m looking for doesn’t exist)
In Go, the default (zero) value for a struct is an empty struct.
Eh, it’s not uncommon to need this distinction. The Go convention is to return (res *MyStruct, ok bool).
An Option type is a cleaner representation.