Le 22/08/2014 09:48, Daniel Murphy a écrit :
"Joakim"  wrote in message news:[email protected]...

Yes, I'm aware of ddmd.  You've mentioned many times that it only
works because dmd is written using a very unC++-like style, to the
point where github's source analyzer claims that dmd is written in
66.7% C, 28.4% D (presumably the tests right now), 4.4% C++, and 0.5%
other. :)

The style dmd is written in makes it a lot easier, but it would still be
possible with other styles.  As others have said the github numbers have
nothing to do with the style of the code, only the naming of the files.

Given tools like libclang, how hard do you think it'd be to translate
most of actual C++ to D?  If writing such a tool would mean that
C++->D translation is the path of least effort for D users who want to
integrate with C++, maybe that's the approach that should be taken
instead.

A tool that can translate an arbitrary C++ program to D is not going to
happen.

A tool that can translate a specific C++ program to D is not
particularly difficult to produce, as I've done with dmd.  eg multiple
inheritance cannot be generally mapped to D code.  But in many
applications, the use of multiple inheritance _can_ be mapped because it
corresponds to classes + interfaces.  This type of application-specific
knowledge can significantly reduce the complexity.

DDMD actually has a major additional complication that most translations
would not have - it is only a partial translation (glue layer stays in
C++) and therefore needs abi stability across the boundary.  I initially
did a non-abi-stable translation of only the frontend, and it was rather
easy in comparison.

So no, you can't magically upgrade a project from C++ to D.  But it can
be done, and is not prohibitively difficult someone experienced with C++
and D.

As many told it including Walter it seems impossible to be able to convert arbitrary C++ code to D, but having a tool that is well documented on what it can convert without issue will certainly be enough interesting.

My point is, if some part of your C++ can't be converted you certainly can refactor it to fit in something supported by the conversion tool. Here the point is the tool must not be able to do imperfect conversion, it better to exit in error when something isn't well supported.

As Andrei told, there is certainly ways to do a configurable tool, to help it to convert some parts.

Even if a such tool can't convert any C++ code, it might help to interface C++ with D, by converting the main part (every day modified code) of a C++ software. In this sense I am more interested by converting the C++ I write than those of third party libraries. Maybe just as Facebook?

The other question is what will be the result of the generated binary in term of performances?

Reply via email to