On Tuesday, 8 May 2012 at 13:57:30 UTC, bearophile wrote:
foobar:
As others said, the only thing that sort-of makes sense is to
copy/paste *declarations* and even those are different enough
in D that they deserve at least a look over to make sure they
are correct.
We shouldn't promote this "goal" at all especially given that
it isn't even guarantied to be 100% correct in all cases.
Really what we should be promoting is the fact that D is
_link_ compatible with C and allows you to use existing C code
_without_ porting it to D.
For various reasons I have translated many times routines,
functions and other small and medium amounts of C code to D. And
in many cases I have used the C std lib functions to circumvent
bugs or limitations or performance problems of Phobos. In both
cases I have found the C functions quite useful, so moving them
into not built-in stuff is bad for me. The risk of using C
functions by mistake is low enough.
Bye,
bearophile
That does not contradict what I said. No one stops you from
_translating_ C/C++ code (or any other language for that matter)
to D. You shouldn't however rely on _copy/pasting_ C code and
expect it to magically just work with 100% certainty.
I also did not say that using C headers should be forbidden,
merely that it should obey the code organization - the current
scheme which was defined by Walter is to put such headers in
Deimos.
I wouldn't mind if Deimos would come bundled with the D
tool-chain or be easily accessible via a package manager, Just
that code should be kept organized according to our own defined
scheme. Besides, what if I find it useful to use e.g. FORTRAN
code, should the relevant functions also be in the stdlib?