Eric Nibler is a well-known C ++ expert, one of the important contributors to
Boost , a man who added the Ranges library to the standard.
On August 26, as part of the C ++ Party, Eric
will speak at Yandex’s Novosibirsk office, where he will talk about the library and talk with guests about the new C ++ standards.

')
I spoke in advance with Eric and asked him a few questions from myself and colleagues about how he sees the present and future of C ++, what he thinks is the most important in programming, whether C ++ will ever have a normal package manager, modules, what will happen to library and much more.
By the way, if you have more good questions for Eric, you can ask them in the comments, and we will ask him to answer them.
Original for those who prefer to read in English (alas, Eric does not speak Russian yet)How did you start to code on C ++? Do you write a code by yourself (boost and stl not counted) or just consult?
I learned C ++ as an undergraduate student at the University of Virginia. It is actually required back then.Writing the code is like breathing or eating for me. If I didn't do it daily, I would die. Find me working on this week.
What would you most advise to be changed in the language? Were there any wrong decisions in the C ++ history? What would you change?
But it’s a little bit different. C ++ is a great language for building libraries. We just need more.
What should be improved in C ++ first?
There's really so much: compile times, better support for Generic Programming, reflection, ranges, Unicode support, etc, etc. If you were a transfigured
manager. There is a way to find out, download, compile, and download.
What do you think about C ++ Standards Committee? Does it do a good job? Or is it too slow or conservative in some respect?
As a long-term member of the Committee, I probably have a different perspective. Design-by-committee happens. Catering to the experts happens. Solving small problems while isolated. But on the whole, it’s a group of volunteers. And the “release cadence” has been picked up dramatically since C ++ 11. It's a full-time job to keep up with it all. It's exciting to be a part of it.
What is the W3C?
Better in some ways, worse in others. I've occasionally wondered if C ++ has Python has in Guido. It is sometimes a chooses both and adds a third option. That's bad. It is a good idea to choose the right solution. But nobody chooses right every time. Distributing the decision making. I know my way through the committee gauntlet. It's grueling, but C ++ as a whole is better for it, IMO.
Is there a chance to have some backward compatibility?
I don't see that happening ever, no. In the library, perhaps, but not in the language.
What is your favorite code language after C ++?
For simple scripting stuff, I reach for Python. Every now and then I poke at Haskell a bit. I like the rigor and math-y-ness. I am not proficient enough to be productive yet.
Do you always understand when using Boost?
Not right away, no.
Does it help you?
Absolutely. I can haz modules? :-)
Do you use exceptions in your C ++ code?
I write exception-neutral code (exceptions can pass through harmlessly), but I don’t often write code that throws exceptions. If you’re thinking about what you’re thinking about As a library developer, I don’t always interact with the outside world. (It's messy out there.) I am concerned about the internal consistency of programs. Eg, has this API been called incorrectly? For those sorts of errors (so-called logic errors), I use assertions.
Do you want to rewrite?
I usually like it and I want to rewrite it. Library design is the most important part of library design.
If you had to choose?
Again, my perspective is skewed here. I feel that decltype was the most sorely needed feature before C ++ 11. When I look back, I am deeply grateful
anymore.
The same question, but about the most controversial changes. Is there something that can have a negative effect?
Certainly: rvalue references. They are powerful, but they are powerful. My style has evolved such that I can feel confident about.
Noexcept gets honorable mention here. Not even the Committee.
How to deal with the complexity of the language?
Program in the "modern" subset. C ++ code these days.
C ++: It makes it easier to make it easier to make it easier to make it easier or more complex. Deprecate the bad stuff (see: throw specifiers, auto_ptr). Write tools that help people in the modern subset (see: clang modernize).
C ++ is sometimes criticized, Standard Library, Spartan, Standard Library. It doesn’t Do you think this is the right approach?
Absolutely not! The criticism needs to be greatly expanded. I want: Unicode support, databases, date support, serialization, networking, parsing, etc. The list is endless.
It is a library. Do you think that this should be the case?
Who says this? I have never heard this view espoused in the Committee. Folks there are eager to expand the Standard Library.
Many people are asking for some standard repository. What do you think about this? The C ++ community can make it possible?
YES. Together with tooling, it is today, IMO. Some clever folks have tried to solve this problem, with limited success to date. It would take Microsoft or a Google (or a Yandex?) To really fix this, I think. It's the kind of hard boring
get up by volunteers.
C ++ is terrible, in fact, it’s actually used. How do you think about large projects?
C ++ is a very good language for large-scale projects, projects and projects where performance and footprint matter. I wouldn't pick C ++ for a simple scripting task. It's all about picking the right tool for the job.
What do you think is rarely used on mobile devices? All these new things use managed languages. Java for Android, Objective C and Swift for iOS. What does you think?
I'm dumbfounded that C ++ isn't used more heavily on mobile. These are resource-constrained devices. Why pay for a VM?
In the C ++ for the sake of portability. It is just too awful to consider. It's a “well duh” that's been a long time
coming.
What do you think about Rust?
I've heard some positive buzz, but I haven't looked into it.
What is your favorite C ++ IDE?
Visual Studio, hands down. I tried it (I’ve tried it a long time ago). Emacs / vim / gdb feels like cruising speed. (Cue the angry trolls telling me what I Luddite I am for disparaging Emacs / vim / whatever.)
How did you convince the Committee that the Ranges library is important?
I got the job by volunteering to do the work, I think. It was a committee meeting. I first presented my work.
Some developers think that C ++ include too much poorly compatible features, that language is exaggerated. Do you share their opinion? If you were creating a language from scratch There is a chance that some parts of modern C ++
Parts of C ++ have been defined (throw specifiers). I won't argue that C ++ has warts. It does. Something from your legacy, like the declaration syntax. It has been a lot of things that have been used (iostreams, locales, string). Concepts, but I’ve seen a compelling use for virtual inheritance. I think inheritance is grossly overused. I would like to emphasize that it is dynamic polymorphism with value semantics (see: Sean Parent, "Inheritance is the Base Class of Evil").
I would love to see the preprocessor go away. C ++ because of the preprocessor. I would prefer an AST-based, hygenic macro processor. Let me manipulate AST at compile time. Never again.
What is more important for you: aesthetics or practice? If the answer is practice, what?
Aesthetics are important, but if I thought it was the most important thing. That said, I think "aethetics vs. practicality is a false dichotomy. C ++ is quite close.
It’s a funky way to make it. This is what programming is about. Making C ++ is better than this. It has to solve real-world problems. But it also has to be elegant. It is easy to read correctly. Elegant code is a joy to use. If I can do it, then I’ve done my job.
Tell us how you started programming in C ++? Do you still write the code yourself (boost and stl do not count) or are you only consulting?I learned C ++ as a student when I studied at the University of Virginia. He was an obligatory subject. For me, writing code is like breathing or eating. If I do not do this every day, I die. You can look at my
githaba for what I do this week.
If you created C ++ from scratch, what would you do differently?I have a few complaints about the language, but there is an important flaw in the Standard Library that I would like to correct - it is too small. C ++ is a great language for creating libraries. There should be more.
In which areas is it better to improve C ++?There are not so many of them: compile time, improved support for generic programming, reflections, ranges, unicode support, and so on and so forth. But, if I had to choose only one piece that would most affect C ++, I would choose a simple, reliable and powerful package manager. Looking for, downloading, compiling and installing libraries with all their dependencies is
too difficult now.
In your opinion, is the Standardization Committee doing its job quite effectively?Since I am a longtime member of the Committee, my point of view on this question is probably different from the usual one. Sometimes there is a “development committee” when a seven nannies have a child without an eye. Sometimes narrow problems are solved without a systematic approach. But in general, it seems to me that the Committee is doing its job well, especially for its format, and this is the format of a group of volunteers. And the rhythm of releases has improved significantly, especially after C ++ 11. Just stay up to date with everything that is happening - full-time work. I'm glad to be a part of it.
Perhaps it would be better if there was one person who is responsible for key decisions?On the one hand, it is better, but on the other - worse. I sometimes wondered if it would not have been better if C ++ had its own enlightened dictator, like Guido at Python. In cases where the committee needs to choose between two incompatible types of a feature, sometimes it chooses both and adds a third option. This is bad. The alternative is to trust one person to always make the “right” choice. But no one chooses correctly in one hundred percent of cases. Splitting such a decision into several people significantly reduces the likelihood of missing something bad through the Committee. I am sure that my work is getting better from having to go through the Committee’s inferno. This is exhausting, but C ++ benefits in my opinion.
How did you manage to convince the committee of the need for the Ranges library?I was entrusted with this simply because I was engaged in this work. The committee was ready to agree on almost any sufficient quality proposal for Ranges. When I first presented my work, it was almost audible how everyone in the committee exhaled quietly.
Some developers believe that C ++ contains too many different capabilities that are not compatible with each other, that the language is “bloated”. Do you share this opinion? If you were designing the C ++ language from scratch, what existing possibilities would you not include in it? Are there any chances that some parts of our modern C ++ will be declared obsolete in the future and not recommended for use?By the way, C ++ parts are already declared obsolete (throw specifiers), and some have already been removed from the standard (export templates and auto as the variable storage specifier). I will not argue that C ++ has its own deformities. Of course have. Some are inherited from C, such as the syntax of declarations. Some of the features added to the standard, in the work with which we have not had enough experience (allocators), and some were simply poorly designed and inflated (iostreams, locales, string). I have never seen a situation where the use of virtual inheritance would be justified (OK, I used it myself to emulate Concepts, but I hope that this will not be necessary in the future). I think inheritance is used too often. I would remove the accent from it and provide a simple and understandable way for dynamic polymorphism with value semantics (read "Inheritance is the base class of all evils" by Sean Parent).
I would be glad to catch the moment when the preprocessor goes into the past. Other languages ​​have very cool tools that cannot be implemented in C ++ due to the existence of a preprocessor. I would prefer in its place an
AST- based pure macro processor. Let me control my program's AST at compile time. And I will never again need to insert or replace anything.
Is there any chance that in some version of C ++ there will be no backward compatibility, as was the case with some other languages?I do not think that this will happen, no. Maybe separate libraries, but definitely not a standard language.
What is your favorite programming language after C ++?For simple scripts, I use Python. Sometimes experimenting with Haskell. I love rigor and mathematics. It's funny to figure out how things are arranged there, but my experience is not enough to do something serious.
When you use Boost, is it often the case that you can hardly understand a multi-page message from the compiler?Not always.
Does it upset you that if you connect the Boost library to a project, compile time slows down?Of course. When will there be modules? :-)
Do you use exceptions when writing in C ++?I usually write code that is exception-neutral (one that does not affect other people's exceptions), but quite rarely I throw exceptions from my code. My understanding of life is this: exceptions should be used only for breakdowns in runtime, when the structure of the world is not compatible with the state of the program. And as a library developer, I rarely interact with the world outside (there is too much turmoil.) First of all, I focus on the consistency of the internal code device. For example, did this API method call correctly? For this type of error (they are called logical), I use assertions.
When you view your code over time, do you like it or do you want to rewrite it?I like it,
and I want to rewrite it. Redesigning libraries is the most important part of their construction.
What would you like to see in the new C ++ standard? What feature of C ++ do you consider the most harmful and most useful?I repeat that in my opinion here is strongly affected by the fact that I am a library developer. It seems to me that decltype was the most desperately needed feature before the advent of C ++ 11. When I recall all those crooked crutches that I had to use in Boost to do without decltype, I immediately become very, very grateful to the world that we will not have to do this anymore. If we talk about the changes that had a negative effect, then this is definitely the rvalue of the link. They are very powerful, but they are very difficult to use correctly and too easy - wrong. I myself learned to use them strictly only in those cases in which I am absolutely sure.
I can not fail to mention noexcept. Even committee members cannot agree on how and where to use them properly.
Do you have advice on how to deal with the complexity of the language?Program only on a modern subset of the language. Nowadays, you can write clean, clear and beautiful code in C ++.
As for development in such complex languages ​​as C ++, change the old code to improve the uniformity of the code (see uniform initialization), and make it so that people can easily and safely do complex things that are easily mistaken (see auto, range-form, smart pointers). Stop using obsolete (see auto_ptr, throw specifiers). Create tools that will help people develop a modern subset of the language (see clang modernize).
C ++ is often criticized for being too short and abstract, almost spartan standard library. There is no such diversity, as in some modern languages. Do you think this approach is correct?Definitely not! Criticism is fair: A standard library should get bigger. I want support for Unicode, databases, date / time, serialization, network stack (with support for a large number of different protocols), parsers, etc. etc. The list is endless.
The authors of STL believed that the standard library should be small and atomic. This is one of the reasons that there are not some basic things for our time in it. What do you think about it?Who says that? I have never heard such an opinion expressed by someone in the Committee. Everyone is ready to expand the standard library.
Do I need a C ++ single repository?YES. In addition to the lack of convenient tools, I consider this the main obstacle to the even wider distribution of C ++ now. Several smart guys are already trying to solve this problem, but so far with mixed success. It seems to me, to solve it, perhaps you need a giant like Microsoft, Google (or Yandex?). This is a difficult, big, boring and not glory task of the type that volunteers do not like to do.
There are many people who have to use C ++ despite the fact that they do not like it. What do you think, by what principles should the language be chosen for large projects?C ++ is very good for large projects and such projects where performance and small size of the result are important. I would not choose C ++ for tasks that can be solved with a simple script. It is always important to choose the right tool for the task.
Is it bad that C ++ is rarely used on mobile devices? All of them still work in managed languages: Java on Android, Objective-C, and Swift on iOS. Is it time to more actively use C ++ in this area?I am shocked that C ++ is not actively used in mobile development. There are devices with limited resources. Why spend money on a virtual machine?
But in fact, today I hear more and more often that teams write part of the logic of mobile applications in C ++ for the sake of portability. The need to support different code in different languages ​​for different platforms becomes too terrible. This is an insight that must come sometime.
What do you think of Rust?I heard good words about him, but did not understand in detail.
Which IDE do you prefer to work with C ++?Easy question: Visual Studio. I have not tried CLion yet, but Eclipse was the last time I used it (quite a while ago, I must admit), it was so terrible that I couldn’t describe it with words. Using emacs / vim / gdb is like trying to make a wheel with stone tools, while the rest of the world has been driving highways for a long time. (Yes, this is for you, evil trolls, who tell me that my disregard for emacs / vim is a sign of luddite.)
What is more important for you in your work: aesthetics (to make the language or library more beautiful, slimmer) or practice (to make them more convenient for everyday tasks)? If the second, then what tasks do you think of first?Aesthetics is important, but if I considered it the most important thing in the world, I would program in Haskell. With this in mind, I think that “aesthetics versus practicality” is a false dichotomy. You can have this and that. And it seems to me that modern C ++ programming style brings us very close to this.
The daily tasks that are important to me are those that occur again and again in every program at any level and on any topic: writing and using ALGORITHMS and thinking about their complexity, efficiency and correctness. Programming is about that. Making C ++ better applicable for this is what raises me every morning. Language must be effective, must solve problems from the real world. But he must be elegant. Elegant code is easy to write, easy to read, easy to use and difficult to use incorrectly. Elegant code is fun when you use it. If I can add pleasure to the everyday life of C ++ developers, I will consider my work done.
PS: You can still
register for the event. You can also go to Yandex offices in Nizhny Novgorod, Yekaterinburg and Minsk to participate in a teleconference and ask your questions to Eric. For those who can not reach us, we will organize the broadcast, which will be available
here . The start of the broadcast is at 16:00 Moscow time (19:00 - Novosibirsk time).