logoalt Hacker News

Surac • today at 7:16 PM • 3 replies • view on HN

Still non ABI. Why is ist so hard? what is holding them back. Andy why does it need a unsave keyword? can't they marshal types like other languages?


Replies

kbolino • today at 9:02 PM

You can marshal values, but you can't marshal lifetimes, ownership, (lack of) thread-safety, (lack of) side-effects, etc. The ABI carries far less information than the Rust compiler relies on. Thus, any FFI call is inherently unsafe. It takes you, the programmer, with knowledge the compiler doesn't have and the architecture doesn't provide, to determine whether the code as you use it actually is safe or not.

galangalalgol • today at 8:30 PM

It is explained elsewhere, but a summary is that any language with generics is going to have any stable abi as a subset of the language. There is already a subset of the language that is a stable abi, it is the c abi. Expanding that subset has to be worth it in terms of what people actually want to export from a library. As I use generics fairly heavily I don't think I would use that expanded abi for anything.

adamch • today at 7:18 PM

because they change the binary layout sometimes, and the benefits have not yet been judged to be worth freezing it.