r/cpp
•
u/steveklabnik1
•
Oct 24 '24
•
1
Why Safety Profiles Failed
https://www.circle-lang.org/draft-profiles.html
180
Upvotes
View all comments
Show parent comment
11
u/ts826848 Oct 25 '24
It doesn't have to be, but since the committee only considers submitted papers and the subset here is what the profiles paper describes it's what people discuss. Other subsets (e.g., Hylo, scpptool, others?) would probably be more widely discussed if a concrete proposal is submitted.
Yes and no. It's true that static checks of any kind will falsely reject some safe code patterns, but the key difference is that Rust's analysis is generally accepted to be sound so that if Rust says code is safe you can rely on it to actually be safe. One of the main criticisms of the lifetime proposal is that it's (claimed to be) unsound, so you can't actually rely on the code it accepts to actually be safe!
The argument (correct or not) is that Rust's model is the only suitable one that is proven both in theory and in practice, so if you want a safe alternative sooner rather than later it's pretty much the only game in town. The other alternatives people either have constraints that aren't considered to be suitable for C++ at large (GC) or don't have significant amounts of practical experience (profiles).
scpptool might be an outlier here but it doesn't seem to have as much mindshare and I'm not super-familiar with it so I'm not entirely sure how it'd be received.
The thing is that the lifetimes profile promises that annotations are largely unnecessary, but critics claim that many common C++ constructs actually require annotations under the lifetimes profile. In other words, the claimed problem is not that you'll need an annotation - it's that you'll need annotations. Lots and lots of them, contrary to what the lifetimes profile claims.
A more restrictive analysis would give you even more false positives, so if anything it'd hurt, not help. It could/would also reduce false negatives, but that's not what the bit you were quoting is talking about.
There's an implicit assumption here that "an annotation" is sufficient to produce a result comparable to "an incompatible language split". The contention is that this assumption is wrong - "an annotation" is insufficient to achieve temporal safety, and if you want temporal safety enough annotations will be required as to be tantamount to a language split anyways.
The thing is that proponents of Safe C++ don't want to see vague statements like this because in their view they are sitting on something that is known to work. If alternatives are to be considered, they want those to be concrete alternatives with evidence that they work in practice rather than vague statements that may or may not pan out in the future.
As an analogy, if I submit a proposal saying "Replacing all references/iterators/smart pointers with raw pointers will lead to temporal safety" you don't need to wait for me to actually implement the proposal before dismissing it as nonsense. An implementation of a proposal is necessarily going to follow the rules set out in the proposal, and if the rules in the proposal are flawed then an implementation of those rules will also be flawed.
That's similar what critics of lifetime profiles are saying. It doesn't matter that there's no implementation since they claim that the rules are flawed in the first place. They want the rules to be fixed first (or at least clarified to show how an implementation could possibly work), so that a future implementation actually has a reasonable chance of being successful.
In other words, sure, invest some time, but fix the foundations before building on top of them!