
Interfacing D To Legacy C++ Code
About this video
Walter Bright explains to the Northwest C++ Users Group how the D programming language can interface directly with legacy C++ code. He covers why C++ is hard to interface with and how D approaches the problem.
Why it appears in the archive
HN uses it as evidence that D has unusually good C++ interop and as Walter Bright's account of the challenges D is tackling.
AI-generated summary and labels from the source dataset; verify important details against the video. Source & credits.
From the Hacker News discussion
Reasons for D: It is a way out of the C++ tar pit, because it does C++ interop better than any other language. D needs to continue to outrun C++ evolving, though. See [LINK] or [VIDEO] It has powerful meta-programming. It is effectively the opposite of Go, which does not even have generics. This certainly provides foot shooting as well, so other languages (e.g. Rust) are more conservative with that. D examples: [LINK] Those are the two reasons, which D has ahead of all other languages (ok, not Lisp wrt meta-programming). If you compare it to another specific language, there are more things to talk about.
Read original comment ↗Rust does not have native C++ interop. C ABI is different to what clasp has done (native C++ interop). All widely used Common Lisp implementations have seamless C ABI interop through their FFIs / CFFI [1]. Clasp goes above and beyond that and natively interfaces with C++. LTO works with mixed Common Lisp and C++ code. Exception handling works as expected. You can mix Common Lisp and C++ stack frames. Correct me if I'm wrong but Rust does not have anything equivalent. The language that comes closest is D I think [2]. [1] [LINK] [2] [VIDEO]
Read original comment ↗Another alternative, I think is D-language bindings to QT (or betterC which is a subset of D allowes to use D with C runtime library, while retaining D-s class system, templates and memory safety). [1] [LINK] D's team is doing an incredible job of matching C++ compiler specific ABIs, name mangling/etc -- just so D users can use C++ libraries (including templates) directly from D without loosing the features of the language. [2] [LINK] Here is also an older video of Walter Bright (2015) talking about the challenges that D is tackling [3] [VIDEO]
Read original comment ↗