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
-2
u/germandiago Oct 25 '24
I think I already said everything I had to in comments in all posts so I am not going to say anything new here. and I do get your point.
I just think that if the only way is to do such a split in such a heavy way, that is a big problem.
In fact, solutions that catch a smaller subset is probably more benefitial (remember this is not greenfield) and probably incremental proposals are needed over time, like constexpr, but always without leaking unsafety.
I think the best solution possible should have the restriction of being benefitial to existing code and not change the semantics of the language so heavily. That is my position.
It can be done? Well, yes, we can also do Haskell on top of C++: we add immutability, a garbage collector, immutable type system, pattern matching and everything and then we say it is compatible because you code in that new language that is a split from the first one. This is exactly what Safe C++ did to the point that the std lib must be rewritten and I think this is a very valid critic.
Some people are worried a solution "inside C++" is not effective enough.
So making a 90% impact in existing codebases and having code improved and compatible since day one and still, anyway, having a safe subset that is regular C++ is going to be less benefitial than a disjoint language where you need to port code? Really?
If we have to write safe code, and safe code is new code under Safe C++, what's the problem if we need to learn or add a couple of incremental things and learn a couple new ways to write some patterns that cannot be expressed in this subset in exchange for compatibility? After all, it is going to be safe, right? Instead of that, we fit a new language inside and send all existing code home...
Did you check the paper, btw? https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1179r1.pdf