No video

Cpp2 - First Impression [Programming Languages Episode 27]

  Рет қаралды 3,225

Mike Shah

Mike Shah

Күн бұрын

Пікірлер: 73
@189Blake
@189Blake Ай бұрын
Leaving aside the syntax, everything that goes under the hood of how it translates Cpp2 to C++ is amazing in itself.
@MikeShah
@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.
@bobweiram6321
@bobweiram6321 2 ай бұрын
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?
@MikeShah
@MikeShah 2 ай бұрын
I am actually quite impressed with how well this works with cpp2 -- it might be the right way to transition/evolve the language
@bobweiram6321
@bobweiram6321 2 ай бұрын
@@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.
@mishaerementchouk
@mishaerementchouk 2 ай бұрын
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.
@MikeShah
@MikeShah 2 ай бұрын
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
@isodoublet Ай бұрын
Already gone? Where to?
@mishaerementchouk
@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
@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
@MikeShah Ай бұрын
This feels like just a better C++ syntax 🙂
@androth1502
@androth1502 2 ай бұрын
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.
@MikeShah
@MikeShah 2 ай бұрын
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_chupe
@Chupe_chupe 2 ай бұрын
Great video Mike
@MikeShah
@MikeShah 2 ай бұрын
Cheers!
@jaycarlson2579
@jaycarlson2579 Ай бұрын
Your a great teacher!
@MikeShah
@MikeShah Ай бұрын
Cheers, thank you for the kind words!
@kevintucker322
@kevintucker322 2 ай бұрын
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
@MikeShah
@MikeShah 2 ай бұрын
I imagine there are several other 'prior art' this is indeed learning from -- nice example!
@jimhewes7507
@jimhewes7507 2 ай бұрын
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.
@MikeShah
@MikeShah 2 ай бұрын
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
@vladimirkraus1438
@vladimirkraus1438 2 ай бұрын
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?
@MikeShah
@MikeShah 2 ай бұрын
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.
@kevintucker322
@kevintucker322 2 ай бұрын
Will be interesting to see what languages official name will be
@muhammadharris4470
@muhammadharris4470 2 ай бұрын
Cpp2?
@MikeShah
@MikeShah 2 ай бұрын
@@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
@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
@MikeShah Ай бұрын
Indeed -- I hope safety by default is emphasized , especially when it comes to casting. My contact info is in my Channel Info.
@cyrilemeka6987
@cyrilemeka6987 Ай бұрын
@@MikeShah Thanks for the reply. I really enjoy your videos, by the way.
@MikeShah
@MikeShah Ай бұрын
@@cyrilemeka6987 cheers!
@Nop_90h
@Nop_90h 2 ай бұрын
Lets overview the HolyC language
@MikeShah
@MikeShah 2 ай бұрын
I thought you were joking that this exists, but indeed it actually looks pretty neat :)
@kevinchopra9111
@kevinchopra9111 2 ай бұрын
Is Cpp 2, backwards compatible?...
@MikeShah
@MikeShah 2 ай бұрын
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.
@kevinchopra9111
@kevinchopra9111 2 ай бұрын
@@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?...
@MikeShah
@MikeShah 2 ай бұрын
@@kevinchopra9111 If it takes the C++ approach, C++ does not break backwards compatibility.
@hebozhe
@hebozhe 2 ай бұрын
These vids are like 30 Days episodes, but for PL nerds.
@MikeShah
@MikeShah 2 ай бұрын
Exactly 😁
@matthijshebly
@matthijshebly 2 ай бұрын
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++.
@bertiesmith3021
@bertiesmith3021 2 ай бұрын
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.
@theintjengineer
@theintjengineer 2 ай бұрын
I am curious to know on what language you'd say one should be spending wasting his/her time, in your opinion. Thanks.
@bsdooby
@bsdooby 2 ай бұрын
@@theintjengineer Good point. Every is a waste of time (for some others).
@theintjengineer
@theintjengineer 2 ай бұрын
@@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.
@bsdooby
@bsdooby 2 ай бұрын
@@theintjengineer 100 % agree.
@firstname4337
@firstname4337 2 ай бұрын
C++ is such an ugly, ugly language -- absolutely horrible syntax
@thegameoflife9179
@thegameoflife9179 2 ай бұрын
@@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
@martinjanas
@martinjanas 2 ай бұрын
I would say Rust has worse syntax than C++ lol
@MikeShah
@MikeShah 2 ай бұрын
I think C++ 20 has made things quite nicer -- but indeed every language has their quirks, especially when they're 4 decades old :)
@user-ft6zh8ny9i
@user-ft6zh8ny9i 2 ай бұрын
well, it's garbage. I'd better continue using C++. And now I'm using C++26.
@martinjanas
@martinjanas 2 ай бұрын
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-ace
@mister-ace 2 ай бұрын
Agree. This looks horrible… So… c++ syntax forever…
@simonfarre4907
@simonfarre4907 2 ай бұрын
Because it's easier to parse and lex. It's why almost all new languages follow this convention.
@vladimirkraus1438
@vladimirkraus1438 2 ай бұрын
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;
@simonfarre4907
@simonfarre4907 2 ай бұрын
@@vladimirkraus1438 exactly my point, but better explained.
@martinjanas
@martinjanas 2 ай бұрын
@@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.
Carbon - First Impression [Programming Languages Episode 28]
1:04:02
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 6 МЛН
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 14 МЛН
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 252 М.
" Free Pascal: Past, Present and Future" by Detlef D. Overbeek & Mattias Gaertner
46:24
IPC (International Pascal Congress)
Рет қаралды 907
Is C++ better than C?
1:46:10
Tsoding Daily
Рет қаралды 44 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 83 М.
OOP in Pure C
2:00:13
Tsoding Daily
Рет қаралды 72 М.
why do header files even exist?
10:53
Low Level Learning
Рет қаралды 395 М.
I Took a LUNCHBAR OFF A Poster 🤯 #shorts
00:17
Wian
Рет қаралды 6 МЛН