| Thread overview | |||||||
|---|---|---|---|---|---|---|---|
|
October 22, 2015 C++ to D explainer | ||||
|---|---|---|---|---|
| ||||
Someone needs to write up a good translation of a C++ project to D, showing how the code is better in D and particularly demonstrating D idioms instead. The ongoing DDMD project, translating the dmd frontend from C++ to D, may be a good project for this, or someone might just want to translate some other small to mid-size C++ project instead. A blog post explaining what they did would be very worthwhile. People often talk about how D is its own thing on this forum and in reddit comments, how it's not just C++ with a couple nice features and some slightly different syntax, as many C++ people seem to think. Well, those new D idioms need to be shown explicitly and translating a C++ project to specifically contrast the two languages would be a good way to do it. I'll be translating Android C++ samples like these to D soon, so that people have some D sample code to try out on Android, but they're too small to use many D idioms: https://android.googlesource.com/platform/development/+/master/ndk/platforms/android-18/samples/ | ||||
October 22, 2015 Re: C++ to D explainer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joakim | On Thursday, 22 October 2015 at 03:34:17 UTC, Joakim wrote: > Someone needs to write up a good translation of a C++ project to D, showing how the code is better in D and particularly demonstrating D idioms instead. This seems to be a good start: http://dlang.org/cpptod.html Still only scratches the surface though. | |||
October 22, 2015 Re: C++ to D explainer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joakim | On Thursday, 22 October 2015 at 03:34:17 UTC, Joakim wrote:
> Someone needs to write up a good translation of a C++ project to D, showing how the code is better in D and particularly demonstrating D idioms instead. The ongoing DDMD project, translating the dmd frontend from C++ to D, may be a good project for this, or someone might just want to translate some other small to mid-size C++ project instead. A blog post explaining what they did would be very worthwhile.
>
> People often talk about how D is its own thing on this forum and in reddit comments, how it's not just C++ with a couple nice features and some slightly different syntax, as many C++ people seem to think. Well, those new D idioms need to be shown explicitly and translating a C++ project to specifically contrast the two languages would be a good way to do it.
>
> I'll be translating Android C++ samples like these to D soon, so that people have some D sample code to try out on Android, but they're too small to use many D idioms:
>
> https://android.googlesource.com/platform/development/+/master/ndk/platforms/android-18/samples/
It would also be very effective to have a modest program that is demonstrated under different memory management schemes in D as the concern about the GC seems to be one of the biggest issues to address. Show people what a reference counted or manual or lazy, non-allocate etc solution looks like on the same program.
| |||
October 22, 2015 Re: C++ to D explainer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Joakim | On Thursday, 22 October 2015 at 03:34:17 UTC, Joakim wrote:
> Someone needs to write up a good translation of a C++ project to D, showing how the code is better in D and particularly demonstrating D idioms instead. The ongoing DDMD project, translating the dmd frontend from C++ to D, may be a good project for this, or someone might just want to translate some other small to mid-size C++ project instead. A blog post explaining what they did would be very worthwhile.
Using the DMD translation for this may not be the best code base. It has been said that Walter writes his C++ in a D style. If nothing else, it is not what people "into" C++ would consider C++ style.
| |||
October 23, 2015 Re: C++ to D explainer | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jesse Phillips | On Thursday, 22 October 2015 at 22:29:03 UTC, Jesse Phillips wrote:
> On Thursday, 22 October 2015 at 03:34:17 UTC, Joakim wrote:
>> Someone needs to write up a good translation of a C++ project to D, showing how the code is better in D and particularly demonstrating D idioms instead. The ongoing DDMD project, translating the dmd frontend from C++ to D, may be a good project for this, or someone might just want to translate some other small to mid-size C++ project instead. A blog post explaining what they did would be very worthwhile.
>
> Using the DMD translation for this may not be the best code base. It has been said that Walter writes his C++ in a D style. If nothing else, it is not what people "into" C++ would consider C++ style.
Also, DDMD is nowhere close to being idiomatic D yet; it's got raw pointers all over the place, often uses `int` rather than `bool`, all the functions are marked `extern (C++)`, use of Phobos is forbidden, etc.
The first step was just to get it working. Refactoring the code base into natural, streamlined D code will be a long process - especially since fixing bugs, adding new features, and avoiding regressions are all higher priorities for almost everyone working on it.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply