Тёмный

Cpp2 - First Impression [Programming Languages Episode 27] 

Mike Shah
Подписаться 23 тыс.
Просмотров 3,6 тыс.
50% 1

Опубликовано:

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 77   
@breadiusloafus5068
@breadiusloafus5068 Месяц назад
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.
@MikeShah
@MikeShah Месяц назад
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.
@KulaGGin
@KulaGGin 27 дней назад
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.
@KulaGGin
@KulaGGin 27 дней назад
_"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.
@189Blake
@189Blake 3 месяца назад
Leaving aside the syntax, everything that goes under the hood of how it translates Cpp2 to C++ is amazing in itself.
@MikeShah
@MikeShah 3 месяца назад
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 3 месяца назад
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 3 месяца назад
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 3 месяца назад
@@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.
@jimhewes7507
@jimhewes7507 3 месяца назад
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 3 месяца назад
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
@cyrilemeka6987
@cyrilemeka6987 3 месяца назад
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 3 месяца назад
Indeed -- I hope safety by default is emphasized , especially when it comes to casting. My contact info is in my Channel Info.
@cyrilemeka6987
@cyrilemeka6987 3 месяца назад
@@MikeShah Thanks for the reply. I really enjoy your videos, by the way.
@MikeShah
@MikeShah 3 месяца назад
@@cyrilemeka6987 cheers!
@vladimirkraus1438
@vladimirkraus1438 3 месяца назад
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 3 месяца назад
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.
@androth1502
@androth1502 3 месяца назад
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 3 месяца назад
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 3 месяца назад
Great video Mike
@MikeShah
@MikeShah 3 месяца назад
Cheers!
@cbbcbb6803
@cbbcbb6803 3 месяца назад
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 3 месяца назад
This feels like just a better C++ syntax 🙂
@kevintucker322
@kevintucker322 3 месяца назад
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 3 месяца назад
I imagine there are several other 'prior art' this is indeed learning from -- nice example!
@jaycarlson2579
@jaycarlson2579 2 месяца назад
Your a great teacher!
@MikeShah
@MikeShah 2 месяца назад
Cheers, thank you for the kind words!
@kevintucker322
@kevintucker322 3 месяца назад
Will be interesting to see what languages official name will be
@muhammadharris4470
@muhammadharris4470 3 месяца назад
Cpp2?
@MikeShah
@MikeShah 3 месяца назад
@@muhammadharris4470 I think indeed they'll just use 'cpp2' or 'cppfront'. It's probably the least confusing name to me if this takes off.
@mishaerementchouk
@mishaerementchouk 3 месяца назад
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 3 месяца назад
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 3 месяца назад
Already gone? Where to?
@mishaerementchouk
@mishaerementchouk 3 месяца назад
@@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.
@Nop_90h
@Nop_90h 3 месяца назад
Lets overview the HolyC language
@MikeShah
@MikeShah 3 месяца назад
I thought you were joking that this exists, but indeed it actually looks pretty neat :)
@kevinchopra9111
@kevinchopra9111 3 месяца назад
Is Cpp 2, backwards compatible?...
@MikeShah
@MikeShah 3 месяца назад
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 3 месяца назад
@@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 3 месяца назад
@@kevinchopra9111 If it takes the C++ approach, C++ does not break backwards compatibility.
@BartonBleazard-t9c
@BartonBleazard-t9c 15 дней назад
Heller Ports
@hebozhe
@hebozhe 3 месяца назад
These vids are like 30 Days episodes, but for PL nerds.
@MikeShah
@MikeShah 3 месяца назад
Exactly 😁
@matthijshebly
@matthijshebly 3 месяца назад
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 3 месяца назад
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 3 месяца назад
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 3 месяца назад
@@theintjengineer Good point. Every is a waste of time (for some others).
@theintjengineer
@theintjengineer 3 месяца назад
@@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 3 месяца назад
@@theintjengineer 100 % agree.
@firstname4337
@firstname4337 3 месяца назад
C++ is such an ugly, ugly language -- absolutely horrible syntax
@thegameoflife9179
@thegameoflife9179 3 месяца назад
@@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
@martinjanas
@martinjanas 3 месяца назад
I would say Rust has worse syntax than C++ lol
@MikeShah
@MikeShah 3 месяца назад
I think C++ 20 has made things quite nicer -- but indeed every language has their quirks, especially when they're 4 decades old :)
@Принуждениекмиру-ь2ц
@Принуждениекмиру-ь2ц 3 месяца назад
well, it's garbage. I'd better continue using C++. And now I'm using C++26.
@martinjanas
@martinjanas 3 месяца назад
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 3 месяца назад
Agree. This looks horrible… So… c++ syntax forever…
@simonfarre4907
@simonfarre4907 3 месяца назад
Because it's easier to parse and lex. It's why almost all new languages follow this convention.
@vladimirkraus1438
@vladimirkraus1438 3 месяца назад
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 3 месяца назад
@@vladimirkraus1438 exactly my point, but better explained.
@martinjanas
@martinjanas 3 месяца назад
@@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.
Далее
ТИПИЧНОЕ ПОВЕДЕНИЕ МАМЫ
00:21
Просмотров 1,1 млн
САМАЯ ТУПАЯ СМЕРТЬ / ЧЕРНЕЦ
1:04:43
My first look at Lazarus and Free Pascal
14:27
Arenas, strings and Scuffed Templates in C
12:28
Просмотров 89 тыс.
Andrew Kelley   Practical Data Oriented Design (DoD)
46:40
What Makes A Great Developer
27:12
Просмотров 197 тыс.
Clean Code is SLOW But REQUIRED? | Prime Reacts
28:22
Просмотров 311 тыс.