June 18

On Monday, 16 June 2025 at 16:49:51 UTC, Dejan Lekic wrote:

>

On Sunday, 15 June 2025 at 12:46:09 UTC, rempas wrote:

>

That seems interesting! In general, it would be nice if we lived in a world where there would be a common IR and backend and languages would just target that, allowing you to use any symbol from any language.

In the case of C, C++ and D (and many others) that is exactly what is happening. They share the same backend.

I'm not an expert in compilers, but why can't languages be "married" on IR level? I mean compiler translates source code D and C++ to IR independently where these representations are "linked" together.

June 18

On Saturday, 14 June 2025 at 11:39:01 UTC, rempas wrote:

>

Improvements

Implementing a C++ parser will have the following advantages:

  • C++ libraries will be able to natively been used in D. This includes "macros" and templates that have not been initialized in the actual library and would need an additional initialization from the project that would use them (making the process even more tedious, slow and overall annoying).

  • C++ and D code will be able to be combined, giving the ability for any C++ project to more easily and smoothly get fully transit to D. That will bring even more popularity and trust to the language.

It's been done already:

https://github.com/Syniurge/Calypso

-Johan

June 18

On Wednesday, 18 June 2025 at 01:39:00 UTC, Andrey Zherikov wrote:

>

On Monday, 16 June 2025 at 16:49:51 UTC, Dejan Lekic wrote:

>

On Sunday, 15 June 2025 at 12:46:09 UTC, rempas wrote:

>

That seems interesting! In general, it would be nice if we lived in a world where there would be a common IR and backend and languages would just target that, allowing you to use any symbol from any language.

In the case of C, C++ and D (and many others) that is exactly what is happening. They share the same backend.

I'm not an expert in compilers, but why can't languages be "married" on IR level? I mean compiler translates source code D and C++ to IR independently where these representations are "linked" together.

The problem is type-safety, iirc LLVM IR is just about type width, but then C++ and D also have structs, OOP, templates. But you are right, it can do this right now, LDC has options to output IR/bytecode.
However without this rich type information you MUST always write correct code because in that case compiler is unable to tell if you have a wrong types, and your program will end up malformed, doing nonsensical calculations on nonsensical inputs. Ok in reality you still need type information in form of manual declarations to please the type system.

btw check out my gentool, it partially translates C++ to D on AST level and nicely matches linker level interop feature of D, I built it originally to help with my gamedev needs, but since then there is not much interest even in D community so now it is basically in maintenance mode and I switched to godot.

June 18

On Wednesday, 18 June 2025 at 01:39:00 UTC, Andrey Zherikov wrote:

>

On Monday, 16 June 2025 at 16:49:51 UTC, Dejan Lekic wrote:

>

On Sunday, 15 June 2025 at 12:46:09 UTC, rempas wrote:

>

That seems interesting! In general, it would be nice if we lived in a world where there would be a common IR and backend and languages would just target that, allowing you to use any symbol from any language.

In the case of C, C++ and D (and many others) that is exactly what is happening. They share the same backend.

I'm not an expert in compilers, but why can't languages be "married" on IR level? I mean compiler translates source code D and C++ to IR independently where these representations are "linked" together.

IR is already too late to put things in common. Type information is already lost, for example nowadays the LLVM IR does not make any difference between int* and int**, it's up to the front-end to check that kind of things.

For example : https://godbolt.org/z/v6cG9Y65c. Only the front end knows the valid input types.

Also you have the problem of the ABI. It's just delusional to think you can call a foreign function if you have it's LLVM IR. To some extent that will work but it's not sane.

June 25

On Monday, 16 June 2025 at 16:49:51 UTC, Dejan Lekic wrote:

>

In the case of C, C++ and D (and many others) that is exactly what is happening. They share the same backend.

Yeah, I mean also a way to compile files from multiple languages and have them read files from other languages and been able to call their symbols.

June 25

On Wednesday, 18 June 2025 at 06:33:00 UTC, Johan wrote:

>

It's been done already:

https://github.com/Syniurge/Calypso

-Johan

Ehhhmmmm... Lats commit was 5 years ago?!

1 2
Next ›   Last »