I’ve seen some people in the community that don’t like Cpp2's syntax. But it's actually really nice, you read from left to right, like English (the : is pronounced 'is a,' and the = is pronounced 'defined as') while significantly reducing the quirks you need to remember. The compiler is also really smart; I mean, just look at the generated .cpp code-best practices by default. It also supports 'use at your own risk' code paths (non-owning raw ptr, unchecked array access), which still allow writing metal code. Not to mention it has full backward compatibility while being great for new projects, there're no languages out there that can do both. I really hope it goes mainstream sometime soon.
I'm also a fan of cpp2 -- little things even like UFCS, and the other touches put in are great! The ability to work with CPP code seems like this is indeed a path forward.
I don't like the syntax but I like the features. Specifically, I don't like the fact that I have to type name of the variable before the type but I love all the features: reflection, metaclasses, named return variables.
_"it has full backward compatibility while being great for new projects, there're no languages out there that can do both"_ Typescript. Herb Sutter took it from Typescript, he talked about it in his presentations on cppcon.
Agreed! At the very least, it's an interesting tool to see how concepts translate, and what the sort of best practice is, as that's what is attempted to be generated from cpp2.
@@MikeShah I agree, but I really wish we had something like Ada's type specifications. It would reduce the need for unit testing and makes the code a lot more intelligible. Also, I'm kind of sick of the terse C style syntax. When code looks like art and reads like a story, it makes it sooo much easier to deal with. C++ and C, as well as Python, encourages sloppiness. It's hard to articulate this to programmers because they have a utilitarian POV. It's why Apple succeeds, function follows form.
I've been following cpp2. I really like the consistency in the way objects and functions are defined. I also like the way parameters are passed for example "in", "inout", etc. Simpler to deal with and less to remember. However currently cfront is not a compiler and so cpp2 can't do anything that can't be done in C++20. I also like Sean Baxter's Circle compiler which can do cool things like "choice" types and now even has a borrow checker like Rust. Ideally I'd love to see Herb's cpp2 syntax merge with Sean's Circle compiler. Although I guess that's not so likely to happen since I think one of the Circle compiler's goals is to stay faithful to cpp1 syntax as much as possible. My question about all this, though, is whether the C++ committee would even consider actually changing the language. Or will they just continue to add more stuff to the existing language every three years. Herb did a video pointing out that it can take ten years to adopt a totally new language whereas cpp2 can be adopted faster because it can just be mixed with cpp1 a little at a time. However, I think it would still take ten years anyway because the committee doesn't work that fast.
It's a good question if a cpp2 would win what the evolution looks like -- eventually you could just have that be the compiler, though I suspect that's a several years away
Cpp2 looks fun and different, aming to be more expressive, consistent and safe. I wonder, are implicit or arithmetic conversions a thing in cpp2? If true, i hope herb changes that, because those are nightmarish for me in C++. Also, do you have a contact info?
Regarding the features and the syntax, I actually quite like it. It does not hurt my eyes and the code seems very consistent, unlike cpp1, and much simpler and safer. I see one drawback however and please correct me if I am wrong about this... But it seems to me that it cannot generate cpp1 header files (i.e. good old *.h or *.hpp) from cpp2 file. Therefore the adoption into an existing cpp1 project is somehow limited. I can write a module in cpp2 which depends on cpp1 code. But I cannot replace a module written in cpp1 with a cpp2 code if any other cpp1 module depends on it, because I cannot get the backward compatible cpp1 header. Or is there any way to do this?
That's a good question if there's a two-way interop between cpp1 and cpp2 -- I don't exactly know the answer (perhaps I misunderstand the question). I imagine there could be blocks to just use or ignore cpp1 or cpp2 syntax to mitigate any edge cases.
something like this can put c++ on life support into the coming decades, to make it a bit more consistent given the awful frankenstein's monster state that c++ is in today. if i had to use c++, i would want to use something like this. though i would prefer something that fixes C instead. that's why odin, zig and the fictional language of jai are so intriguing to me.
Indeed, Odin, Zig, JAI, and betterC (D's C compiler that adds many nice features) have done an excellent job filling the niche of C (and Rust as well). I'm excited to hear the next update on cpp2, as it would be a nice language to write code in.
I think sometimes people learn, or develop, New languages just to feel superior to people that are not "in the know". Sometimes it is genuinely to create or do something better.
Mixed feelings. It’s like cpp2 tries to catch an already gone train. There’s nothing particularly wrong about it but nothing stands out as particularly right. Probably, I expected better error messages but the accident with vector was quite bad. I should play with it on some toy project to get a better impression but it doesn’t look like cpp2 is poised for widespread industry adoption.
@@isodoublet To the current state of the C++ syntax. Arguably, cpp2's syntax wouldn't work as the original syntax, particularly for social reasons. However, if cpp2 appeared around 2011, the future development could be quite different. By then, no one needed persuasion that C++ has its place, yet C++11 came with so many novelties that a reworked syntax and advanced semantics had a lot of chances to catch on. With cpp2, the madness of "C++ is C with classes" wouldn't survive for long. However, at this point in time, with C++11's novelties commonly adapted and, on the other hand, projects like Carbon on the horizon, the place for cpp2 appears to be uncertain.
Meaning with previous versions of Cpp2? I'm not sure what kind guarantees will be provided, but I imagine that is something top of mind for the designers.
@@MikeShah If I were building a Kernel, and I had done so with CPP, would patching it etc or rebuilding it, whether monolithic or modular, require you to alter the source?...
It’s a public service. There’s a huge amount of c++ being maintained and celebrated, and the devs need help to avoid the many pitfalls. You can say that we just rewrite it all in but the reality is that re-writing is slow, error prone and expensive. Herb believes that a slow migration is in fact cheaper and more likely to succeed. He might be ambitious, but the cost to the world of failure to deal with all the legacy cruft is huge, so it’s worth his time. I hope it gets picked up by some big corporation and gains significant traction.
@@bsdooby, precisely. That's why my motto is: if you enjoy learning and dealing with it - do it. Everything else will be just an opinion/advice that might not work for you.
@@bo4-x2n c++ and before it c only became popular because programmers did not like assembler or other languages that were available at the time (and i know that because i lived through it)... to be honest i cannot understand why they remained popular for so long... i reckon the main reason is because so much has been written in them now forces programmers into having to use them.... and that is all, not because they are so great in any way
Cpp2 looks like garbage, I hate when "new" languages overcomplicate stuff as this: s: std::string = "world"; just why??? They should either do s = "world" or like in standard c++ std::string s = "world", this is just extra steps.
std::string s = "world"; vs s: std::string = "world"; differs in one extra colon character, if I am not mistaken. I think this is a small price to be paid to have fully uniform declaration and assignment syntax. And cpp2 is definitely not the only modern language that decided to use this convention. In other cases the cpp2 syntax is much more concise, e.g. i := 1; is definitely shorter than auto i = 1;
@@vladimirkraus1438 ah ok, now I understand.Tbh I dont mind about the syntax being shorter or longer, for me its the order of the words, but I can totally see myself being accustomed to it.