| |
| Posted by Paulo Pinto in reply to matheus | PermalinkReply |
|
Paulo Pinto
Posted in reply to matheus
| On Thursday, 10 March 2022 at 02:01:01 UTC, matheus wrote:
> Hi,
>
> Today someone sent me this video: https://www.youtube.com/embed/ABg4_EV5L3w
> (C++ Weekly - Ep 313 - The `constexpr` Problem That Took Me 5 Years To Fix!).
>
> It's a 26 minute long video of a guy trying to generate a concatenated string during CT in C++.
>
> I was flabbergasted by the problems this poor guy had in front of him for a thing that shouldn't seem so complex (In my opinion of course). And more yet that he has being struggling with this for 5 years.
>
> So I decided to try the same with D, it was 14 lines[1] of code written in less than a minute and it just worked on the first try. Then I looked the Assembly code:
>
> .L.str:
> .asciz "hello world, hello world, hello world, "
>
> After that I even asked over the D IRC channel if it was just this? And a user confirmed that my string was being generated through CT as the Assembly indicated.
>
> Again incredible. My first programming language was C, then in 2000-ish I had my first contact with C++ and I just hated and went back to C and then while looking for alternatives I stumbled on D which I use till this day as a "super C".
>
> But now after so many years I couldn't believe the C++ is still struggling even to this day with this type of thing.
>
> I'd like to quote this comment from the video:
>
>> meowsqueak:
>> "Well done solving this puzzle, but I’m left in shock. The need to employ a template, static constexpr variables, a lambda function, and four utility functions just to compile-time generate a static string in C++ is an embarrassment."[2]
>
> And indeed it is an embarrassment. Well D may have it flaws but I always found it lot time better or less restrictive language compared to others, especially C++.
>
> Finally I'd like to take this moment and thank for all the effort.
>
> Matheus.
>
> [1] - Here is the snippet I wrote: https://godbolt.org/z/MsT36Prx4
> [2] - Youtube comment: https://www.youtube.com/watch?v=ABg4_EV5L3w&lc=Ugzb7kTLS8GNS9bK07F4AaABAg
>
> PS: I'm a ESL, sorry for any English mistakes.
Well, a language alone doesn't make ecosystems, D is a good language, but after 10 years doesn't hold a candle to CUDA, Metal, Unreal, SYSCL, AUTOSAR/MISRA certifications, iOS/Android/Windows SDK, High Energy Physics research, PyTorch/Tensorflow, LLVM/GCC, ....
Before bashing C++'s design, which does indeed have plenty of flaws with several books describing them, what about finishing all those previews that are already 5 years and longer in the making and finally decide what domain D is good at?
The way I see it, C# 10 and C++ 20 have mostly catched up in where D was 10 years ago, Rust and Go have found out a way to push them into devs regardless of what they think about them, thanks all those Cloud Native Foundation projects, Khronos is slowly adopting Rust alongside C++ on some of their ongoing standard discussions.
Creating such ecosystems is what D should worry about, not how great a bare bones compiler is against the competition.
|