On Sunday, May 06, 2012 21:18:38 foobar wrote: > On Thursday, 3 May 2012 at 22:57:02 UTC, Walter Bright wrote: > > On 5/3/2012 8:13 AM, Don Clugston wrote: > >> Well, they are also used in druntime, in core.stdc.math > >> BTW I *hate* that module, I don't know why it exists. Even > >> worse, it seems to be > >> growing -- people are adding more things to it. > > > > It's there simply because all the Standard C headers should be > > represented. It should not get anything that is not in Standard > > C. Ditto for all the other stuff in core.stdc. > > > > It's there to make converting C code to D code easier. > > This argument comes up every once in a while even though AFAIK it > is *not* a goal of D and never has been! > D does not and *should not* strive to be source compatible with > C. We already have C++ for that and it is a horrible idea. > D can link with C which allows to use pre-existing C code. we > should *not* encourage converting C code to D code at all. Either > just link the C code or use D idiomatic code.
Then you misunderstand. One of the tenets that D holds to is that any C/C++ code either compiles as valid D code with identical semantics, or it doesn't compile as D code (there are a few minor exceptions - such as static arrays being passed by value - but not many). This means that we can break compatibility with C/C++ and do our own thing for a lot of stuff but that we can't just redefine what stuff does such that it would silently break code when it's ported from C/C++ to D. That approach is _very_ different from C++'s approach where valid C code pretty much _always_ compiles identically in C++ (the fact that C++ added keywords being the only exception that I can think of at the moment), but that doesn't mean that we don't care about code portability from C/C++ to D. There's a huge difference between designing a language such that porting code to it from another language isn't error-prone and making the new language source compatibile. D does the former. C++ does the latter. Being able to port code from C/C++ to D without having to worry about silent breakage _is_ one of D's goals. - Jonathan M Davis