On Thursday, May 03, 2012 13:43:11 Sean Kelly wrote: > On May 3, 2012, at 1:11 PM, Don wrote: > > On 03.05.2012 21:08, Sean Kelly wrote: > >> On May 3, 2012, at 8:13 AM, Don Clugston wrote: > >>> On 03/05/12 16:13, Andrei Alexandrescu wrote: > >>>> Good ones. In fact I even discounted them from this discussion because > >>>> I'd already considered them gone. Walter agreed that I don't mention > >>>> them in TDPL, with the intent to have them peter out. > >>>> > >>>> One good step right now would be to remove NCEG operators from the > >>>> online documentation. Later on, we'll consider them an accept-invalid > >>>> bug :o). > >>> > >>> 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. Practically > >>> everything in there has a better implementation in std.math.>> > >> core.stdc.math corresponds to C99's math.h and is there as a part of the > >> standard C interface. It should only contain the required C99 > >> prototypes, and in some cases functions if the C implementation is a > >> macro. If there is anything nonstandard in there, I'm not aware of it.> > > Yes, but why do we have it? We're not C. > > Mostly because it was handy to fall back on the C API before Phobos was so > well fleshed-out. Today, I think it mostly exists to ease porting of C > apps.
In principle, having prototypes for the entire standard C library in druntime seems like a good idea to me. In practice though, it could cause problems due to people using the C functions rather than the D functions for some things (e.g. the math functions). If we properly documented them all though, we could then put comments about the correct D function to use to replace each C function which has a D replacement, and then it could actually help people move away from the C functions. - Jonathan M Davis
