Recently ended DConf 2014 conference was, as usually, a great event filled with interesting topics about the D language. I still need to update my little knowledge about the language and see more presentations, but one keynote especially drew my attention. This was a talk from Scott Meyers called The Last Thing D Needs.

But… hmmm… why C++ guy on a D conference? And why he had slides without D code… only C++? Strange…

Scott Meyers has a unique presentations skills. I, especially, like his introductions! Although most of his slides are white background + some code, he sometimes uses pictures to be ‘more visually appealing’ :)

But, let’s go back to the topic… He talked about the following things:

  • Scott introduced himself as a ‘professional explainer’. He usually explain C++ features, the standard and concepts to other people.

  • Then he went with a quiz about various C++ ideas. Most of the time he used only integers and some basic class design. For instance

    • variables initialization - int a; - global variables vs local variables. Globals (or statics) are, by default, initialized to 0. Local variables are not - because it would bring a runtime cost.
    • Type deduction with auto, decltype and template. Sounds easy, but, for instance, for argument forwarding we need to bend some rules.
    • Type deduction for lambdas and captured variables. 6 different rules.
    • Four ways of initializing an int with value 0.
    int xa = 0;
    int ab(0);
    int xc = { 0 };
    int xd { 0 };
    
    • Why {0} has no type for a simple function template <typename T> void f(T p); and why it generates error.
    • Inheritance and templates
    • Computational Complexity and std library. For instance you can use std::binary_search with a list.
    • Naming inconsistency in STD
    • C++ vs D - D is much younger language so, hopefully, it can learn from C++ mistakes and be even better.
    • Meyers pointed out that, although, everyone in the committee knows about C++ problems they, actually, do not want to fix it, there a more important things to fix/add.
    • Tools vs Applications: Tools are needed to create some higher level things. Like, for instance, use gardening tools to create amazing garden. But it would be painful if you need too much time on learning how to use the tool.
    • We all know Scott Meyer’s books. But maybe there are too many rules to follow for C++? Wouldn’t it be great to have only few of them?

The final slide:

“The Last Thing D Needs… is… someone like me”.

Conclusion  

The whole presentation is not about “why c++ sucks and why is D better”. In my opinion, the author, points out that D can learn from its great predecessors and simply be better. For such young language, we can for instance, change spec more often (even if it breaks old code) in order to fix some design problems. Moreover, it is important to have a light but powerful language that can be easily explained and convenient to learn.

BTW: here you can find translation of C++ examples from the talk into D: the link