|
|
Log in / Subscribe / Register

DeVault: Announcing the Hare programming language

DeVault: Announcing the Hare programming language

Posted May 2, 2022 23:37 UTC (Mon) by roc (subscriber, #30627)
In reply to: DeVault: Announcing the Hare programming language by atnot
Parent article: DeVault: Announcing the Hare programming language

Zig has excellent interop with *C++*, really? I don't see that.


to post comments

DeVault: Announcing the Hare programming language

Posted May 3, 2022 0:07 UTC (Tue) by atnot (guest, #124910) [Link] (1 responses)

Perhaps I shouldn't have mentioned C++ considering the advantages are less apparent there (or arguably it is even behind compared to bindgen and cxx's capabilities).

But either way, there's a lot more to compatibility than just understanding the language constructs. A lot of existing C and C++ code, unfortunately, has very unclear data ownership and mutability. Trying to wrap that in a language with much different and stricter memory semantics is usually a pretty bad time. I have given up on it multiple times before. So while Zig may not understand C++ headers (yet?), I do think it's already much closer to working well with it by default.

DeVault: Announcing the Hare programming language

Posted May 3, 2022 11:00 UTC (Tue) by tialaramex (subscriber, #21167) [Link]

In modern C++ you're going to have a lot more cases where ownership is represented via a smart pointer (std::unique_ptr or std::shared_ptr), which is something Rust can get behind easily, but Zig can't really help you with. So it's probably going to shade over, C++ code that's mostly 15-20 years old may be happier to work with from Zig, while C++ code that's all written after say C++ 14 might be much easier to work with from Rust via one of the C++ FFI libraries like cxx which understands the standard library smart pointers.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds