logoalt Hacker News

eptcykayesterday at 6:35 PM3 repliesview on HN

The C ABI can already be used, it comes with all the existing safety guarantees that C will provide. Isn’t this as good as C?


Replies

pizlonatoryesterday at 6:47 PM

It is as good as C.

It's also as bad as C.

I'm saying that the chasm to cross is a safe ABI.

show 1 reply
ozgrakkurtyesterday at 6:56 PM

I found c ABI a bit too difficult in rust compared to c or zig. Mainly because of destructors. I am guessing c++ would be difficult in a similar way.

Also unsafe rust has always on strict-aliasing, which makes writing code difficult unless you do it in certain ways.

Having glue libraries like pyo3 makes it good in rust. But that introduces bloat and other issues. This has been the biggest issue I had with rust, it is too hard to write something so you use a dependency. And before you know it, you are bloating out of control

ahartmetzyesterday at 6:43 PM

Not really. The foreign ABI requires a foreign API, which adds friction that you don't have with C exporting a C API / ABI. I've never tried, but I would guess that it adds a lot of friction.