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
15
u/edvo Oct 25 '24
You mentioned several times in this thread that profiles will provide 100% memory safety, just with a different subset, but I am still not sure if I got your point correctly.
When we have a function
void func(std::vector<int>& vec, int& x)(example from the paper), sometimes it is only safe to call ifxrefers to an element ofvecand sometimes it is only safe to call ifxdoes not refer to an element ofvec. Because the type signature does not tell which one is the case (without further annotations) and the implementation is not always visible, any safe subset would have to forbid calls to such a function (and many others) entirely.Did I understand this correctly? Because in general it seems to be a very limited and borderline unusable subset if such functions could not safely be called at all. And my impression was that the current profiles proposals in particular do allow some calls to such functions, which would mean that they do not provide 100% safety.
You seem very passionate about this point and I wonder if I just got it wrong. Could you please clarify which subset exactly you have in mind, whether its the same that is proposed for profiles, and how it would handle cases like the example above?