The forked elephant in the room
Don Allen
donaldcallen at gmail.com
Mon Jan 29 03:35:07 UTC 2024
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.
Zig also has the ability to translate C headers into Zig. The
result is very similar to ImportC. I believe I mentioned this to
you when ImportC first became available.
I think this is an important capability for both languages. Added
to the ability to call C libraries directly, it makes direct
access, without binding libraries, to C libraries possible. I
think your decision to implement ImportC was a good one.
I've done quite a bit of gtk3 work in Rust. The Rust gtk "crate"
is insanely complex and poorly documented (sometimes even
inaccurate, where they generate the documentation using snippets
from the original gtk3 docs, sometimes including
memory-management things that are not necessary in Rust), unlike
gtk3 itself. I much prefer working directly with gtk3 in D. I did
the D work before ImportC was available, so wrote my own D
function prototypes. Even that was preferable to wrestling with
the Rust "crate" and I'm sure ImportC would have made the job a
lot easier, if it is up to dealing with the gtk header files. I
have tried ImportC with sqlite and that works just fine.
More information about the Digitalmars-d
mailing list