r/cpp • • Oct 24 '24 • Take My Silver 1

Why Safety Profiles Failed

https://www.circle-lang.org/draft-profiles.html
180 Upvotes

347 comments sorted by

View all comments

Show parent comment

1

u/RoyAwesome Oct 25 '24

A lifetime change on one side of the interface may break compatibility with existing binaries and not be detectable.

If you are embedding the annotations, how would that not be detectable?

some int&<'a> foo(vec&<T, 'a>, int&<'b>) being changed to int&<'b> foo(vec&<T, 'a>, int& <'b>) would change the annotations that are embedded in the binary, necessitating changing it's mangled name and causing things asking for the old name to get nothing. To not change the mangled name of this function if you make this change seems like either 1) you aren't embedding enough annotations, or 2) you are misrepresenting the contract.

Sure, this kind of a change is a problem, but it's not silent to my knowledge. That's very crashy if you aren't expecting it. A well implemented library could return an error in this case and an application can handle it.