Last week, I launched a quiz. The price was it to win one of the five vouchers for my book "C++20".
The challenge to win one of the five coupons was to answer the following question: Which feature of the Big Four concepts, ranges, coroutines, and modules excites you most and why?.
Without further ado, here are the winners and their answers. First, I have seven instead of five winners because I could not decide which five answers are
- Gabriel Valenzuela
- Vikas Patney
- Fares Jalled
- Hossein Noorikhah
- Robert Frysch
- Idriss Chaouch
- Darko Zorić
I think that all new features are amazing, we can say C++ has evolved to become a better programming language adding features of Python and/or Haskell for example.
The concepts, like Mr. Rainer Grimm says: "[...] change the way we think and program templates." open the door to the concept of pattern matching one of the most important features of Haskell, and changing the concept of metaprogramming.
The coroutines improve the way of calling functions, providing to users an elegant and efficient abstraction for writing asynchronous code.
The best way to describe ranges is for one important word: "composability". This I think has a strong relationship with category theory.
The modules, for me the main feature, it's the reduction of the size of the compiled code, importing only the parts needed in the project.
I try to resume the key ideas of the Big Four from my viewpoint, possible I lost another important idea, but the new standard I'm sure will revolutionize the C++ industry and generate new challenges, surely with a few problems like all new change, but with the help of the great community It'll overcome quickly and easy.
I am highly interested in learning in depth about the Concepts. The Templates are a building block for our daily use of STL library in C++ programming and the most versatile way of implementing code. Concepts Library allows us to perform compile time validation of template arguments and based on the properties of the types, the function dispatch is performed. With the support of Concepts we can clearly define our template parameters where both the syntactic and semantic properties are correctly evaluated. Hence, a better diagnostic is performed and the related error messages are more explicit.
There are many core language concepts such as same_as, derived_from, convertible_to and many more. I shall be able to understand these concepts with your new book. Thanks for considering me in the contest.
Concepts are very useful to create personalized templates entities. Coroutine is an evolution way to implement different tasks and functions. It generalizes subroutines for non-preemptive multitasking, by allowing execution to be suspended and resumed. Coroutines are well-suited for implementing familiar program components such as cooperative tasks, exceptions, event loops, iterators, infinite lists and pipes. As I write very long codes and need to organize them, I need to use subroutines which are special cases of coroutines. When subroutines are invoked, execution begins at the start, and once a subroutine exits, it is finished. An instance of a subroutine only returns once, and does not hold state between invocations. By contrast, coroutines can exit by calling other coroutines, which may later return to the point where they were invoked in the original coroutine.
For me, the concept of modules is very important and also exciting, and I want to know more about it. I want to know more about the way one module is created and used, because this will change the way we create and use libraries. As C++ is closely tied to the C programming language, I want to know more about the way this will affect C/C++ combination.
One thing that bothers me with C/C++ is the way headers are used. Unless one uses precompiled headers, the burden of multiple includes of headers causes a huge slowdown in compilation. By also adding the complexity of macros, I am hoping for a better way to use libraries. Header-only libraries were an attempt to fix this, but they didn't solve the problem. So, I am curious to know more about the concept of modules. Does one need additional tools like pkg-config? How configurations are managed? Is it OS-specific?
"Concept of modules" is exciting because it is not only a new feature, but it also radically changes the way we interact with others' code, hoping it will simplify the whole process.
I'm most excited about Concepts, as they represent, in my opinion, the most important C++20 feature of the "Big Four" - important for both library and application developers. I have two arguments for this:
- Exclusion principle Regarding Ranges, Coroutines, and Modules, one cannot (currently) be sure that they are more important than Concepts. Ranges are "only" a library feature, whereas the other three are core language features, which can only be used effectively across different compilers and platforms if they are included in the C++ standard itself. In addition, the implementation of the Ranges benefits massively from Concepts. Only the use of Concepts allows meaningful compiler error messages, which are particularly important when using Ranges. Therefore, Ranges can be seen as the first major success of Concepts and evidence of their power. Coroutines and Modules as core language features have the potential to become important game-changers. However, the present standardization offers rather a starting point or a rough framework - for Coroutines, supporting standardized library features are still missing and for modules, there is not yet a uniform procedure to structure files of your C++ projects in a compiler-agnostic way.
- Next level of metaprogramming I think the step from generic Templates to Concepts is comparable to the step from Macros to Templates in the ‘90s - we get another level of abstraction (of course with zero overhead, as it is expected for C++). Templates introduced type safety into the metaprogramming and the introspection by Concepts now introduces safety about type properties. In both cases, there are two big advantages: more expressive code and improved compiler errors.
Concepts, Coroutines and Modules make C++ "feature-complete" from the point of view of Bjarne Stroustrup's book "The Design and Evolution", and of the three, Concepts is probably the most mature C++ feature. I can't wait to use Concepts in my next projects.
I really appreciate the 4 big features introduced by C++20. They came with new improvement especially modules which are a long-awaited feature of C++ that provides better performance in terms of compilation and maintenance. Better compilation: a module is imported only once, similar to precompiled headers supported by custom language implementation. This then reduces time compilation drastically.
How about maintenance? We can import modules in any order. There are no more concerns for macro redefinition. Also, the logical structure of code allows us to select which units should be exported and which should not.
The most exciting C++20 feature of the “Big Four” for me would be the ranges library. Algorithms in the standard library weren’t designed to be easily composed with each other. Instead, they are mostly focused on providing a way to enable the implementation of a more advanced version of an algorithm by applying one specific algorithm multiple times. Because these algorithms are for general purpose and designed to work with iterators, which define a range, they often require writing explicit and sometimes complex code to achieve simple tasks. The thing that bothers me the most is that STL algorithms take those iterators as separate arguments instead of taking the collection itself.
The ranges library fixes all the above problems. Using ranges, we can drastically simplify coding. It is so much comfortable to work with them because we can just call the algorithm on the whole containers - there is no need for begin and end iterators! They allow us to compose algorithms together as much as we want and the code doesn’t get messy and bulky. Unix pipe syntax improves the readability, enables us to have less code, thus fewer errors. The algorithms of the ranges library are evaluated lazily, which helps us to save time and memory. As someone who has just started to learn Haskell in college, I can see how this powerful feature, among others, can significantly improve functional programming concepts in this language.
Congratulations to all Winners. II send the winners the coupons for the book.
Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Animus24, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Kris Kafka, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Matthieu Bolt, Stephen Kelley, Kyle Dean, Tusar Palauri, Dmitry Farberov, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, and Rob North.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, and Slavko Radman.
My special thanks to Embarcadero
My special thanks to PVS-Studio
My special thanks to Tipi.build
My special thanks to Take Up Code
I'm happy to give online seminars or face-to-face seminars worldwide. Please call me if you have any questions.
Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.
- C++ - The Core Language
- C++ - The Standard Library
- C++ - Compact
- C++11 and C++14
- Concurrency with Modern C++
- Design Pattern and Architectural Pattern with C++
- Embedded Programming with Modern C++
- Generic Programming (Templates) with C++
- Clean Code with Modern C++
- Phone: +49 7472 917441
- Mobil:: +49 176 5506 5086
- German Seminar Page: www.ModernesCpp.de
- Mentoring Page: www.ModernesCpp.org