On Friday, 7 May 2021 at 18:17:36 UTC, Jacob Carlborg wrote:
On 2021-05-05 13:54, user1234 wrote:
Thanks for the explanations. BTW I had the same question for
LDC backend being c++, I guess the answer would be similar.
If I understand correctly, the Zig compiler is implemented
partially in Zig. It use the LLVM C API and some wrappers C
around the C++ API where the C API is not sufficient.
And it quickly becomes insufficient using only the C API as
feature complexity increases. No idea if Zig has to deal with C++
compiler (clang) or all it needs is pure LLVM, because the latter
should have more or less feature rich C API, unlike clang that
deals with C++ and has ever "unstable" API. Making wrappers for
missing parts still will be a PITA, as having to pass around
smart pointers definitely does not makes it easier.
Anyway like I said, for bootstrap goal it is probably easier to
re-purpose the tool to make thin wrappers & stubs on C++ side,
pretty much just like SWIG does.
Side note:
But all this does not compares to what potential D to
nextgen-language bindings making process would look like, as D
feature set makes it even harder to translate, esp. stuff like
templates and CTFE, now add static if's to that and it becomes a
real mess.