I am sort of repeating what you wrote, but: I too feel pretty skeptical about a âpass modeâ. It feels like it defeats the whole point of this proposal â put another way, being able to write pass 3 means you have a way to return return Ok(3) that (a) is mildly shorter and (b) doesnât require you to be specific about what the âok-constructorâ is for your particular function, but it still requires you to shift into âanother modeâ.
In my opinion, what makes this proposal valuable is being able to return ânormallyâ â basically being able to treat error handling as a âside channelâ and let the ordinary part of the function be the successful path.
That said, I still feel skeptical of syntaxes that âseparate outâ Result from the return type. I do agree with the criticisms that -> catch R { ... } feels like an odd syntax, though, and â for some reason I cannot quite put my finger on â I donât find -> R catch { .. } particularly elegant.
I was thinking of something. If we changed the (existing) catch syntax to be catch R { ... } and introduced Ok-wrapping, then the following would be a (not particularly ergonomic, nor satisfactory) equivalent to -> catch R { ... }:
fn foo() -> R {
catch _ {
...
}
}
From here, you can certainly see where the idea of -> catch R { ... } comes as a kind of shorthand.
Have to stew on it.
One other thing to think about: we initially chose catch to avoid confusion with try!. However, itâs my impression that try! is pretty well supplanted now with the ? operator. It may be worth revisiting the idea of try { .. } as the syntax for a catch block (and maybe that leads us somewhere at the fn signature level?). My one hesitation is that try R { .. } doesnât seem to make as much sense as catch R { .. } (which reads like âcatch the resultâ).