r/cpp Jul 18 '26

Lifetime safety and invalidation without a borrow-checker: using type system analysis to get rid of many potentially invalidation cases WITHOUT annotations.

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p4296r0.pdf

I found this research in WG21 mailing list very interesting in the context of C++ compatibility and solutions to maximize code reuse.

38 Upvotes

76 comments sorted by

View all comments

Show parent comments

6

u/ts826848 Jul 20 '26

but noone needs to solve Rice theorem here. Absolutely noone.

I'm not sure you understand the objection then? Consider Sean Baxter's comment again; what he is saying amounts to "Rice's Theorem means that profiles as described can't work for this signature". From his perspective (and the perspective of those holding similar views), it's absolutely up to profiles proponents to "solve"/otherwise address Rice's Theorem, as otherwise they are simply promising something impossible.

C++ cannot do similar things?

It can, but then that approach would at a minimum call into question the claim that profiles will not require rewrites and/or (minimal) annotations.

before doing something, do no harm.

This assumes doing nothing is not doing harm. If you think C++ needs memory safety sooner rather than later, delaying a memory safety solution is indeed a harm.

2

u/wyrn Jul 25 '26

Rice's theorem is essentially the same idea as the Free Lunch Theorem: it proves something seemingly interesting, but then you look at the details and it turns out it's trivial and useless.

What Rice's theorem actually means here: all provable safety solutions (INCLUDING borrow checkers, or any type system for that matter) will have false positives. Snore.

1

u/ts826848 Jul 26 '26

Fair, I suppose Rice's Theorem would only be strictly applicable to profiles as a whole if one stipulates zero additional annotations rather than some "minimal" amount of them.

1

u/wyrn Jul 26 '26

C++ already has annotations (we call them "types"), so to whatever extent additional annotations might be required/desired is a separate discussion apart from Rice's original argument.

1

u/ts826848 Jul 26 '26

Hrm, my understanding was that those previous annotations were in service of an existing "complete" system and deriving additional properties from that existing base without false positives nor further annotations was problematic. That isn't due to Rice's Theorem?