On Sun, 26 Aug 2018 at 21:50, Walter Bright via Digitalmars-d <digitalmars-d@puremagic.com> wrote: > > On 8/26/2018 5:40 PM, Manu wrote: > > By contrast, another colleague tried writing a small game in his own > > time. His feedback was that it felt 'fine', but he didn't encounter > > anything that made it "simpler than C++", and claimed readability > > improvements were tenuous. > > He wouldn't show us his code. I'm sure he wrote basically what he > > would have written in C++, and that's not how to get advantages out of > > D... but his experience is still relevant. It demonstrates that C++ > > programmers won't be convinced without clear demonstration of superior > > expressive opportunity. > > Actually, I understand that one. If you look at my conversions of C++ code to > D, > like this one: > > https://github.com/dlang/dmd/commit/8322559195c28835d61c99877ea7c344cb0e1c91#diff-1be391ebabb9f6e11079e1ea4ef1158b > > The code looks the same, and in fact, is about 98% the same.
This code appears to be a mechanical translation. That's not what happened in this case; he wrote his game in D from scratch. It was just that he arrived at mostly the same place. He was googling for styling and sample material, but I suspect the problem was a lack of topical material demonstrating how he might write his D code differently. It's also the case that the significant difference between C++ and D (in my experience) mostly come down to: D has modules, tidier meta, UDA's, slices, and ranges/UFCS. In trade, D struggles with const, and ref is broken. If your code doesn't manifest some gravity towards one of those features, it will tend to be quite same-ey, and advantage may not be particularly apparent. In my current project, we stand to make substantial gains from D's meta and UDA's in particular. I think UFCS could make a big play too. Tidier lambda syntax will also be attractive, however controlling closures with respect to @nogc appears to be a challenge which C++ doesn't suffer. It's all contingent on fighting through outstanding C++ related issues, and making the tooling as good as we can get it though.