Leaving aside the syntax, everything that goes under the hood of how it translates Cpp2 to C++ is amazing in itself.
@MikeShahАй бұрын
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.
@bobweiram63212 ай бұрын
CppFront makes a ton of sense. Modern C++ is already a bunch of macros and meta programming. Why not turn those constructs into its own language?
@MikeShah2 ай бұрын
I am actually quite impressed with how well this works with cpp2 -- it might be the right way to transition/evolve the language
@bobweiram63212 ай бұрын
@@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.
@mishaerementchouk2 ай бұрын
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.
@MikeShah2 ай бұрын
I suspect this project still has a few years of development, but indeed we'll know more (and the developers) as it's used for larger projects :)
@isodoubletАй бұрын
Already gone? Where to?
@mishaerementchoukАй бұрын
@@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.
@cbbcbb6803Ай бұрын
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.
@MikeShahАй бұрын
This feels like just a better C++ syntax 🙂
@androth15022 ай бұрын
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.
@MikeShah2 ай бұрын
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.
@Chupe_chupe2 ай бұрын
Great video Mike
@MikeShah2 ай бұрын
Cheers!
@jaycarlson2579Ай бұрын
Your a great teacher!
@MikeShahАй бұрын
Cheers, thank you for the kind words!
@kevintucker3222 ай бұрын
Sounds similar to GNAT(granted,it’s not a unique language, but it compiles Ada to cans then uses the GCc middle/back- end to generate object code
@MikeShah2 ай бұрын
I imagine there are several other 'prior art' this is indeed learning from -- nice example!
@jimhewes75072 ай бұрын
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.
@MikeShah2 ай бұрын
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
@vladimirkraus14382 ай бұрын
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?
@MikeShah2 ай бұрын
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.
@kevintucker3222 ай бұрын
Will be interesting to see what languages official name will be
@muhammadharris44702 ай бұрын
Cpp2?
@MikeShah2 ай бұрын
@@muhammadharris4470 I think indeed they'll just use 'cpp2' or 'cppfront'. It's probably the least confusing name to me if this takes off.
@cyrilemeka6987Ай бұрын
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?
@MikeShahАй бұрын
Indeed -- I hope safety by default is emphasized , especially when it comes to casting. My contact info is in my Channel Info.
@cyrilemeka6987Ай бұрын
@@MikeShah Thanks for the reply. I really enjoy your videos, by the way.
@MikeShahАй бұрын
@@cyrilemeka6987 cheers!
@Nop_90h2 ай бұрын
Lets overview the HolyC language
@MikeShah2 ай бұрын
I thought you were joking that this exists, but indeed it actually looks pretty neat :)
@kevinchopra91112 ай бұрын
Is Cpp 2, backwards compatible?...
@MikeShah2 ай бұрын
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.
@kevinchopra91112 ай бұрын
@@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?...
@MikeShah2 ай бұрын
@@kevinchopra9111 If it takes the C++ approach, C++ does not break backwards compatibility.
@hebozhe2 ай бұрын
These vids are like 30 Days episodes, but for PL nerds.
@MikeShah2 ай бұрын
Exactly 😁
@matthijshebly2 ай бұрын
I always feel a bit sorry for Herb Sutter. He's clearly talented, but he shouldn't be wasting his time and talent on a language as horrific as C++.
@bertiesmith30212 ай бұрын
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.
@theintjengineer2 ай бұрын
I am curious to know on what language you'd say one should be spending wasting his/her time, in your opinion. Thanks.
@bsdooby2 ай бұрын
@@theintjengineer Good point. Every is a waste of time (for some others).
@theintjengineer2 ай бұрын
@@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.
@bsdooby2 ай бұрын
@@theintjengineer 100 % agree.
@firstname43372 ай бұрын
C++ is such an ugly, ugly language -- absolutely horrible syntax
@thegameoflife91792 ай бұрын
@@user-mm9jy8mz1g 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
@martinjanas2 ай бұрын
I would say Rust has worse syntax than C++ lol
@MikeShah2 ай бұрын
I think C++ 20 has made things quite nicer -- but indeed every language has their quirks, especially when they're 4 decades old :)
@user-ft6zh8ny9i2 ай бұрын
well, it's garbage. I'd better continue using C++. And now I'm using C++26.
@martinjanas2 ай бұрын
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.
@mister-ace2 ай бұрын
Agree. This looks horrible… So… c++ syntax forever…
@simonfarre49072 ай бұрын
Because it's easier to parse and lex. It's why almost all new languages follow this convention.
@vladimirkraus14382 ай бұрын
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;
@simonfarre49072 ай бұрын
@@vladimirkraus1438 exactly my point, but better explained.
@martinjanas2 ай бұрын
@@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.