Interviews: Ask Bjarne Stroustrup About Programming and C++ 427
In addition to being the creator of C++, Bjarne Stroustrup is a Managing Director in the technology division of Morgan Stanley, a Visiting Professor in Computer Science at Columbia University, and a Distinguished Research Professor in Computer Science at Texas A&M University. Bjarne has written a number of books and was elected a member of the National Academy of Engineering. He will be doing a live Google + Q & A within the C++ community on August 20th, 2014 at 12:30pm EST, but has agreed to answer your questions first. As usual, ask as many as you'd like, but please, one per post.
USP (Score:1, Interesting)
Your language has become one of the most popular in history. If you were launching it today, how would you "market" it? What do you think is the unique selling point?
Cutting features and old syntax? (Score:5, Interesting)
Sometimes well-established languages keep adding new features and syntactic constructs until most developers are not even aware of all the possibilities, and use maybe 20% in their usual daily work. The old features and syntax are kept around for compatibility and to keep the old guard content, even if cutting them would lead to faster compilation, more elegant language and less confusion.
This may be part of the reason for the constant introduction of new trendy languages with radically simplified syntax and libraries... Which then follow the same pattern. Few languages are introducing new paradigms, many are trying to be a "better" C++, Java, LISP, JavaScript or Perl.
Do you think this cycle is inevitable, or could it be a good idea to sometimes clean up the syntax and the obscure features in new specification versions, to keep the established languages more competitive?
Is the complexity of C++ a practical joke? (Score:5, Interesting)
C++ is one of the most complex, inscrutable computer languages ever created. When I read about C++11, I was surprised that it layered more complexity and inscrutability on top of what was already there (like the weird lambda syntax). I wonder if C++ has become an over-the-top example of how not to do a programming language. Is that by intent, or did it just happen? In future versions of the language, will any cosmetic changes be made to create a more understandable language that doesn't overload a small set of symbols and keywords, so that normal programmers have a chance to figure out the language? The language seems to have reached the point that C++ gurus design it for other C++ gurus, and everyone else ignores it. C++ was once the up and coming language of choice, but it has become so difficult that programmers have considered it damage and routed around it. Are you comfortable with this fate for C++, as a niche language for insiders, or do you want to use your influence to rehabilitate the language so that more programmers will use it?
On the evolution of C++ (Score:5, Interesting)
How do you feel about the evolution of C++ since it was first implemented with Cfront? What began as a pretty straightforward language has been expanded to significant complexity. Has this evolution been positive, or has it been an attempt to make the language apply to too many possible applications?
Re:Do you think the H1B system is a joke? (Score:3, Interesting)
From your perspective, how is the globalization of commerce and specifically programming affecting you and those you know? Are the new high level scripting tools available to programmers since C++ became popular pushing the profession towards a more "commoditized" state, where people are easily replaceable and where the related skills and specialization eventually offer no better benefits and compensation than other less skilled professions?
Favourite programming language (Score:5, Interesting)
Do you ever feel bad? (Score:3, Interesting)
Regrets (Score:5, Interesting)
What do you regret most in C++ and how would you like to change it?
Replacement for iostream (Score:5, Interesting)
Future of C++ Standard Library (Score:4, Interesting)
One of the recent concerns raised with C++ compared to other popular languages is the breadth of the standard library. I know that the C++ standard committee was looking at adding a C++ transformed version of Cairo to the standard. And of course their is boost. What else do you see coming to address the perceived API shortcomings?
Hour of Code (Score:5, Interesting)
ABI (Score:5, Interesting)
Do you think that one thing holding C++ back is the lack of a standarized binary interface?
Currently if I want to make a module that can be consumed by others (whether than is others using a different language, or a different C++ compiler, or even just to use a pre-built module without sources) I have to export everything as C and use its (de-facto if nothing else) binary standard.
I think an ABI for C++ would increase its "real world" attractiveness considerably with little, if any, overhead. Do you agree, or are there issues around this that make it a significant challenge (apart from vendor adoption of course).
AI writing code? (Score:3, Interesting)
How do you feel about the haters? (Score:5, Interesting)
Templates all over again (Score:3, Interesting)
I'm a fan of C++ overall, but it seems to me that C++ templates are a bit of a disaster. They're so complex that I doubt that anybody but you and P. J. Plauger *fully* understands them. Also, when they're actually used, they often result in bloated, slow code - as I recently experienced when stepping through some STL string functions. Further, they bring on a lot of portability issues, evidently due to the difficulty that even the compiler folks have had in understanding and implementing them. Therefore, many programmers minimize their use of templates, both in their own code and in their use of templated library code.
Compared to the complexity of C++ templates, the C macro preprocessor provides a rudimentary form of templating via its very simple and powerful paradigm of text substitution. I've had some success implementing a limited form of generic (type independent) programming in C using just the C preprocessor. I've had much less success doing generic programming via C++ templates.
If you had templates to do all over again, what would you do differently? Was all the complexity of C++ templates (e.g. "partial specialization") really necessary to achieve its goals? Were the goals maybe too ambitious?
Which feature would you add to C++? (Score:4, Interesting)
If you could add one feature to C++ (either the language or the standard library) and have it adopted in the C++ standard and supported by all the compilers etc, what would it be and why?
C++ without the C (Score:5, Interesting)
Apple recently introduced a language they call Swift or Objective-C without the C. It is technically a completely different language from Objective-C though. When C++ started out it had the major benefit that it was (mostly) compatible with C which at the time was immensely popular, making it trivial to mix new C++ code with existing C code. Today C is still a popular language but not as widely used as it once was. Assuming that C++ could drop C compatibility, how would you take that opportunity to improve C++?
Personal programming projects (Score:4, Interesting)
Apart from work, do you have any personal programming projects going on? Which type of programming do you like most and is there a particular project that you would like to implement?
Code rejuvenation (Score:4, Interesting)
Re:Is the complexity of C++ a practical joke? (Score:0, Interesting)
What stuff is unpleasant to use? The syntax of rvalue references is a bit odd...
Well, the choice of angle brackets for templates isn't exactly pretty, but that ship sailed long ago...
More seriously, the new style C++11 function declaration syntax is needlessly annoying. The committee could have chosen to introduce a new keyword "function", and not much production code would have been broken (though probably much, much more if they had chosen "func"). Altering C++98/C++03 code containing "function" as an identifier doesn't seem like a herculean burden compared to inflicting this choice of syntax on every C++ programmer, forever (for reasonable values of "forever"). The closely related lambda syntax doesn't massage the eyeballs either, IMHO. I'm aware of the committee discussions around the new function/lambda syntax, but simply disagree with the outcome.
I say these things as someone who strongly prefers C++ for most of the tasks I encounter, but even well-crafted C code can look like symbol soup, and it's a little worse for C++98, even more so for C++11. Of course, the new syntax will become second nature soon enough as it has before, but it will remain less than pleasant.
- T