The forked elephant in the room

Walter Bright newshound2 at digitalmars.com
Tue Jan 30 00:57:31 UTC 2024


On 1/29/2024 1:34 PM, Dibyendu Majumdar wrote:
> On Sunday, 28 January 2024 at 17:04:02 UTC, Walter Bright wrote:
>> On 1/28/2024 3:27 AM, Dibyendu Majumdar wrote:
>>> I don't know if I am right but part of the motivation of import C seems to 
>>> have been competition - Zig added the ability to compile C. It seems the idea 
>>> of import C came up after and maybe as a consequence of this.
>>
>> I didn't know Zig did that until after I did ImportC.
> 
> When did you start on importC?
> 
> https://forum.dlang.org/thread/yocvibzernkchgsbcpyb@forum.dlang.org

That post was Dec 3, 2020. The PR for ImportC was May 9, 2021, about 5 months 
later. When did I start ImportC? I don't recall. I don't recall reading that 
thread, either, I don't read all the messages, and am generally not interested 
in detailed comparisons of D with other languages (as it is an endless timesink).

I also was never sure if Zig could actually import C files, or was just able to 
fork a C compiler and link to the result. But this clears it up:

```C
const c = @cImport(@cInclude("soundio/soundio.h"));
```

https://ziglang.org/learn/overview/#integration-with-c-libraries-without-ffibindings

D's syntax is better:

```d
import soundio;
```

ImportC grew out of my discussions with Atila about dpp.


More information about the Digitalmars-d mailing list