4 ms·
I don't see what the problem is. The API should expose two methods: `fetch()` which returns, say, nil if there's no result (or an error monad or error tuple,
by dnautics 7y ago
I don't see what the problem is. The API should expose two methods: `fetch()` which returns, say, nil if there's no result (or an error monad or error tuple, depending on your language), and say `fetch!()` (or `fetch_throws()` if your language doesn't support exclamation points) which raises an exception if there isn't a result. The programmer gets to choose, on a case-by-case basis.
- iainmerrick 7y agoAgreed, it’s ideal to have both options available. Kotlin gets this right for the most part (although I think it would be better if it had checked exceptions).