Re: [PATCH 5/5] types: Add standard __ob_trap and __ob_wrap scalar types
From: Linus Torvalds
Date: Tue Mar 31 2026 - 16:59:16 EST
On Tue, 31 Mar 2026 at 13:31, Kees Cook <kees@xxxxxxxxxx> wrote:
>
> (Isn't this just an implicit "try"?)
Yes. And I think that's ok.
I think try/catch is broken for a few reasons, but the fact that catch
and try are tied together so closely is the main one. You can't "try"
inside a scope without having the "catch" inside the same scope.
So then the solution is to just move the try to the outermost layer,
and I think that's pretty much what everybody does.
But at that point, why not just move it *all* the way out, and make it
implicit and invisible?
Which is kind of exactly what your suggestion is all about, and that's
why I like it so much.
It *literally* fixes try/catch. It makes the only really valid usage
model just work better.
(There are other reasons I dislike try/catch too, the whole
"exceptions across function boundaries" being another one that your
model avoids).
Linus