Get the latest tech news
Safe and efficient C++ interoperability via non-escapable types and lifetimes
Introduction Safely interacting with unsafe code is challenging. The C++ interoperability layer has limited safeguards in place to mitigate some sources of unsafety including hiding some APIs (like methods returning iterators) and exposing them with an “Unsafe” suffix. Unfortunately, these are based on simple syntactic heuristics that are incomplete (like identifying methods that return pointer like objects) and therefore do not provide sufficient safety guarantees and do not provide a way to sa...
The C++ interoperability layer has limited safeguards in place to mitigate some sources of unsafety including hiding some APIs (like methods returning iterators) and exposing them with an “Unsafe” suffix. Moreover, we plan to add or infer lifetimebound annotations for the C++ Standard Library so commonly used methods like vector::front work as expected out of the box. Swift has an optional strict memory safety mode that provides more guarantees than the existing Safe-by-Default model.
Or read this on Hacker News