4 ms·
I could swear I read the exact same article somewhere else a couple of months ago. Anyway, I fail to see how either raising an exception or returning None (whi
by finishingmove 12y ago
I could swear I read the exact same article somewhere else a couple of months ago.
Anyway, I fail to see how either raising an exception or returning None (which the author recognizes as Python's version of null/nil) is anything at all like an Option value (as opposed to "null-like")...
- chcokr 12y agoI sense a connection, for example, between Rust's `fn foo<T>() -> Result<T, E>` and Java's `void foo<T, E>() throws E` (this might be incorrect Java syntax). I'm not entirely confident though.
- barosl 12y agoI find Java's checked exception similar to Option type, because they are all part of the function's type. You cannot pass alone without checking the possible failure case.
- masklinn 12y ago> Anyway, I fail to see how either raising an exception is anything at all like an Option value The author asserts their similarity in that they completely differentiate lookup success and failure, there is no situation under which success and failure can be confused.