3 ms·
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
by skydhash 10mo 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)
- onionisafruit 10mo agoIn Go, the default (zero) value for a struct is an empty struct.
- Cyph0n 10mo agoEh, 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.