visit
Evrone: You’ve created one of the most efficient and fastest programming languages. No doubt, that has changed our world. Have you, as a person, changed while working on it?
Bjarne: Interesting question! Not one I have thought much about. I guess an answer will have to distinguish between properties that have remained constant and those that have changed immensely.
Evrone: Business environment requires respect for strong deadlines while implementing new features. How can developers keep balance between the code quality and the speed of development?
Bjarne: That is so dependent on the management structure and the technical culture. My personal opinion – developed primarily at Bell Labs – the ideal is that you hire the best people, and enough of them, so that you don’t have to have them all work on the next deadline. Some key people have to plan for the future, experiment, and build the first version of the next significant system, and maybe the next after that. I see a good organization building a steady stream of products, most of which will be evolutionary changes from products already deployed and requiring maintenance and upgrades. Clearly, this doesn’t match the common ideas of cost cutting and/or delivering a revolutionary system next year.
Evrone: There is a widespread opinion nowadays that using modern frameworks is more important than applying math knowledge. Could you give any advice to young programmers regarding this?
Bjarne: Time spent on math is never, well, rarely, wasted. Math is one of the best ways to train our brains, especially when combined with computing so that our mistakes become obvious pretty soon. Math teaches us to be accurate and not to believe in oversimplified or simply false ideas.
Evrone: The powerful C++ meta-programming system is sometimes abused by developers who try to move as much as possible from runtime to compilation time. Is this a viable approach from your perspective?
Bjarne: Every new and powerful feature or technique will be overused and misused. I see no way around it. Our enthusiasm always runs away with us, so eventually we must learn to use our tools better and pull back a bit. The good thing is that the overuse teaches us a lot about the weaknesses so that we can remedy them. For example, template metaprogramming was so useful that many reasonable people were willing to ignore its ugliness and appalling error messages. Then, we learned enough to compensate with compiler-time evaluated functions (constexpr and consteval) and concepts, so as to dramatically simplify much of what people were writing.
Evrone: With the arrival of the AlphaCode neural network from DeepMind, there are more and more statements in the press that such neural networks will soon replace programmers. Do you think there are real prerequisites for this?
Bjarne: I don’t really know. I doubt that AI will replace programmers in the kind of programming that I care most about. Serious reliability and close-to-optimal performance are not very amenable to be standardized and averaged. When I hear about AI, which is not one of my strengths, I remind myself that TensorFlow and similar libraries are C++, so that means that I have done my bit – for good and bad.
Evrone: Sometimes we, as developers, can't find a proper solution for a programming task at hand. Have you experienced such situations, and could you share any recommendations on how to deal with them?
Bjarne: Of course! Nobody trying to do something novel or significant hasn’t spent hours, days, or longer being stuck and feeling awful and frustrated.
Evrone: There is an (in)famous joke that any architecture problem can be solved by introducing a new layer of abstraction. Except for the problem of too many abstraction layers. A lot of C++ code we saw had an exceeding number of abstractions. Any advice from the language author on how to keep abstractions count at bay?
Bjarne: That’s David Wheeler’s “First law of computing”. I appreciate that you remember the second half – many people forget that, yet it is essential. David Wheeler was my thesis advisor. He was a wonderful person, and I learned a lot from him.
Evrone: In the past ten years we saw lots of syntax sugar added to the mainstream languages. What do you think about this trend of bloating syntax to provide a somewhat better tooling for experienced developers?
Bjarne: “Bloating syntax” is fine as long as it simplifies the lives of programmers. I tend to refer to it as “Make simple tasks simple.” I think the key idea is to enable a programmer to express fundamental ideas directly in code. For example, there is no virtue or benefit expressing a simple loop over a container in terms of a C-style loop. Better use a range-for or an algorithm. Those directly express the intent in most cases. Leave the detailed fiddling with loop variables to the unusual cases, such as visiting every second element of a container. The more direct expression of ideas is easier to write, easier to read, easier to maintain, and often more amenable to optimization that you need to run faster.
Evrone: Many people think of you as their mentor. Could you share your vision — what qualities should a good mentor have, for example, inside of the company/team?
Bjarne: A willingness to listen and to be serious about understanding the problem. Then, a degree of humility when it comes to giving advice – often, our understanding is incomplete. That said, a good Mentor must give concrete advice, not just general vague twaddle. If someone honors you with a serious question, it deserves a serious answer that helps the questioner to move forward. Giving advice is hard.
Evrone: Could you spoil any upcoming language changes that you think are worth adding to the future C++ versions?
import Mod
to gain access to the interfaces exported
by module Mod
, and nothing else. This gives far better code hygiene than #including
headers that leak implementation details and macros. Modules can also be dramatically faster to compile. For example, I compiled a simple use of import std
ten times faster than #import<iostream>
even though std
holds all of the standard library and <iostream>
less than 10% of that. Module std
is currently experimental but has been voted to be put into C++23.template<typename Iter>
for a template that needs an iterator type. Now we can define such requirements, called concepts
, and use them: template<random_access_iterator Iter>
. Such constrained template arguments have always been the ideal; I just didn’t know how to implement that idea without restricting flexibility or imposing runtime overheads. Now we can check template uses immediately, we can get much improved error-messages when we make mistakes, we can overload function templates, and even improve performance in places.
Now I can come back to your question: What about future versions? Much have been delayed by the pandemic. Many of us would have liked to see some significant projects finished for C++23, but that’s not happening for my favorites. Here, I will mention just three:
Static reflection: we need a mechanism to generate code at compile-time based on the types in the program. That would give us almost the flexibility of run-time reflection without the cost in time or space. For example, it should be very simple to generate an optimal optimized Jason reader for a fixed set of types. Significant work has been done on this.
Pattern matching: The ability to select an action based on how an expression matches a set of type or value alternatives is one of the most convenient ways of expressing alternative actions in many functional programming languages. We can do the same for C++ and in the process make the archaic switch-statement redundant. We have a pretty complete design with an experimental implementation, so I have hope for C++26.
Concurrency model: We have been working on a general model for concurrency for years, but we keep finding use cases that don’t obviously fit, so we have had to postpone. I have hope for C++26. Please remember that it is not individual features that make programming convenient, safe, and efficient. We need a dense network of features that work in combination in the type system. Also, we can’t break the billions of existing lines of C++: compatibility and stability over decades are very importance features.
Also published as The interviewer is the Chief Editor at