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
6
u/ts826848 Oct 26 '24 edited Oct 27 '24
All this is basically irrelevant, because by focusing on the use of
std::sortand worrying about incremental rewrites you've basically completely missed the point of the example.What the example is trying to demonstrate is a soundness flaw in the profiles proposal. The claim is that there are functions for which soundness preconditions cannot be expressed in C++'s type system, and without some explicit marker indicating the presence of these preconditions there's no way for profiles to reject code that doesn't promise to uphold those preconditions.
std::sortis an example of such a function, but there's an infinite universe of possible functions that could be used as an example instead, so having an alternative tostd::sortdoes not fix the underlying issue.If anything, just forget
std::sortwas used. Pretend it's some random function with soundness preconditions:This criticism of profiles is completely independent of the existence of Safe C++. Pretend Safe C++ doesn't exist for all it matters - the example does not depend on it except as a point of comparison, and it provides Rust and C# as further comparisons anyways.