3 ms·
Which kind of begs the question: what it the correct way to use exceptions? Like, python says to throw an exception when an iterator reaches the end so if my c
by UncleEntity 1y ago
Which kind of begs the question: what it the correct way to use exceptions?
Like, python says to throw an exception when an iterator reaches the end so if my custom C iterator does that is it wrong? I do kind of want to be able to do the whole 'for i in whatever: do(stuff(i))' thing so...
- rybosome 1y agoNot the OP, but I assume they mean that it's encoded in the type system. For example Rust gives you a `Result<Thing, ErrorType>`, which might be a `Thing` or might be one of the possible error types given by `ErrorType`. So when you get a function's return value, you have to deal with the fact that it might have failed with this specific error.