Support for C header files in D
Stewart Gordon
smjg_1998 at yahoo.com
Mon Mar 20 07:14:50 PST 2006
Lionello Lunesu wrote:
> Hi again,
>
> This has been mentioned before but I can't find any final word on the
> matter:
>
> <legalese>
> Seeing how D is ABI compatible with C and also the huge amount of useful C
> libraries in existence; also noting the amount of time needed to translate C
> header files, and keeping them up-to-date as new versions come out; finally
> observing that the creator of D has a vast experience in writing C
> compilers, and the fact that the D compiler and C compiler of the
> aformentioned share some program code,
> </legalese>
>
> Why not enable dmd to "import" C header files directly?
<snip>
Because this would happen:
1. People create D projects that will only compile with DMD, because
they rely on a legacy C API with .h files not yet translated into D modules.
2. Writers of other D compilers will feel compelled to build in a C
compiler so that they can compile such projects.
3. It will become a de facto standard that D supports C header files.
4. By making D fully source-compatible with C, it would become bloated
once again with all of C's archaisms and complexities that D was
designed to eliminate. And so things would come full circle, destroying
the ease of implementation issue that is one of the basic design goals of D.
The Internet domain name system is suffering a similar fate in this day
and age. Once upon a time, there was a flat namespace in which every
machine on the net had a unique name. The hierarchical domain name
system we have now came along to replace this, with both the grouping of
entities into .com, .org, etc. along with hundreds of country codes and
the ability to create subdomains to (theoretically) arbitrary depth.
Nowadays, marketing types throw a lot of money down the drain (along
with the safety of their customers) trying to turn it into a flat
namespace once again.
http://domains.dan.info/structure/intro.html
We can do better at keeping D true to its design goals.
Stewart.
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/M d- s:-@ C++@ a->--- UB@ P+ L E@ W++@ N+++ o K-@ w++@ O? M V? PS-
PE- Y? PGP- t- 5? X? R b DI? D G e++>++++ h-- r-- !y
------END GEEK CODE BLOCK------
My e-mail is valid but not my primary mailbox. Please keep replies on
the 'group where everyone may benefit.
More information about the Digitalmars-d
mailing list