Presented at CppCon 2022, cppfront by Herb Sutter is an experiment on making a 10x enchancment to the C++ programming language by implementing a brand new, safer, extra fashionable “lessons learned” syntax. Attempts to enhance C++ are nothing new, as we noticed with Google’s just lately introduced Carbon programming language. This strategy is barely distinction, as it’s simply a brand new C++ syntax, backward suitable with present C++, very related in strategy to the TypeScript programming language. It can be vital to understand cppfront is simply an experiment or proof of idea and most will seemingly by no means exist as a manufacturing stage product.
Design objectives of cppfront syntax embrace:
- repair defaults (e.g., make
- double down on fashionable C++ (e.g., make C++20 modules and C++23
import std;the default);
- take away unsafe elements which might be already outdated (e.g., take away
unionand pointer arithmetic);
- have sort and reminiscence security by default (e.g., make the C++ Core Guidelines security profiles the default and required);
- eradicate 90% of the steering we have now to show about right now’s advanced language;
- make it simple to jot down a parser (e.g., have a context-free grammar); and
- make it simple to jot down refactoring and different instruments (e.g., have order-independent semantics).
cppfront code is hosted on GitHub and may requires a C++20 suitable compiler to construct. Once constructed, cppfront can be utilized to compile cpp2 information to cpp format, which might then be constructed utilizing a standard C++ toolchain.
You can study extra about cppfront and see it in motion within the video beneath.