On 10/22/2011 04:33 AM, Walter Bright wrote:
On 10/21/2011 4:32 PM, Fawzi Mohamed wrote:
On Oct 21, 2011, at 4:20 PM, Fawzi Mohamed wrote:
The main problem with this approach is how to support different
versions of
a library, or of OS. It quickly becomes difficult to support anything
but
the latest, or a fixed version. It works beautifully for mature libs.
Since github has excellent support for branches, I don't see why this is
a major problem.
I still cannot avoid thinking that a C frontend automatically
generating D
modules with the help of recipes would be a better way. It will need
some
manual intervention for "difficult" cases, mainly giving manual
translation
of some macros, but it should be small.
… and it seems that in the time I was offline others came up with the
same
idea...
It's an old idea. The trouble is, as always, the C preprocessor. I'm
currently converting the openssl .h files, and they are a zoo of
metaprogramming using C preprocessor macros.
People are going to demand perfect translation if it is automatic.
The only way to do it is to work with the preprocessed output of the .h
file, and just forget about the preprocessor.
Another way is to replace the preprocessor with CTFE and string mixins.
I think that could be automated quite easily. (modulo the possibility of
some extremely heavy abuse on the C side that could make the other parts
of the translation a lot harder of course)