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
-1
u/germandiago Oct 25 '24
Who says we have to target 100% with the same patterns and paradigms used in Rust? This could be a design mistake altogether.
Yes, and that is not good news. It is packing a lot of new functionality copied from Rust: drop, relocation, lifetimes...
That is not even realistic, it will make a split between two worlds where all old code is basically "trusted" without any real analysis benefit.
Ok, this is a valid point but I think there is still room for some innovation.
std::ranges::sort(v)that composes transitively as far as I understand. You do not need safe/unsafe: you need to know what safety your modules provide. When you compile your code, then the code will detect unsafety according to your profiles (should be the default ones, lifetime, type, bounds, ...).
I also do not know how far the code can be correctly analysed, but if the operator[] is a problem for things like map or std::min it would be a good idea to solve the reference escaping problem for functions and not go fully viral in all the type system. Probably with some annotation and good defaults. Of course I do not know how well this works but I do know the cost of Safe C++ solution: another type system and another object model besides giving up analysis.