|
|
|
|
|
by emmanueloga_
961 days ago
|
|
This video is about cpp2, a proposed new syntax for C++ by Herb Sutter, a famous C++ expert. "The goal is to address existing problems in C++ by embracing the solutions and guidance we've already de facto adopted, and to have to explain less rather than more." [1] I found a repo with some examples of the syntax [2]. For example: myclass : type = {
data: int = 42;
more: std::string = std::to_string(42);
// method
print: (this) = {
std::println("data: (data)$, more: (more)$");
}
// non-const method
inc: (inout this) = data++;
}
main: () = {
x: myclass = ();
x.print();
x.inc();
x.print();
}
--1: https://github.com/hsutter/cppfront/wiki/Design-note:-Cpp2-n... 2: https://github.com/ntrel/cpp2 |
|