Hacker News new | past | comments | ask | show | jobs | submit
Wouldn't it be cooler if you could `return IoError{} from ^` and it would find the closest function in the call stack that can return an IoError?

Even better, you could give it some syntactic sugar like `throw IoError{}`? ;)

P.S. I think the `IoError { message, ok }` type is suspiciously close to `Result<(), String>`.. And if you want to return a value in the success case too it'll become even closer. Perhaps it's best to lean into that and find the calling function that can return an IoError as one of the possible values?