digitalmars.D - C++ to D explainer
- Joakim (17/17) Oct 21 2015 Someone needs to write up a good translation of a C++ project to
- Cauterite (4/7) Oct 21 2015 This seems to be a good start:
- ixid (6/23) Oct 22 2015 It would also be very effective to have a modest program that is
- Jesse Phillips (5/12) Oct 22 2015 Using the DMD translation for this may not be the best code base.
- tsbockman (11/23) Oct 22 2015 Also, DDMD is nowhere close to being idiomatic D yet; it's got
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/
Oct 21 2015
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.
Oct 21 2015
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.
Oct 22 2015
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.
Oct 22 2015
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: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.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.
Oct 22 2015