Rust Features that I Want in C++ - David Sankel - CppNow 2022

  Рет қаралды 36,823

CppNow

CppNow

Жыл бұрын

​Slides: github.com/boostcon
CppNow Website: www.cppnow.org​
CppNow Twitter: @CppNow​
---
Rust Features that I Want in C++ - David Sankel - CppNow 2022
---
By many accounts, Rust is one of the fastest growing programming languages out there. While there are many factors fueling this growth, this talk will focus on the aspects of Rust that make it particularly attractive as a systems programming language. This covers tooling, community, strategy, and, of course, features.
Throughout the talk we'll be revisiting the question, "Can we have this in C++ and, if so, how can we get it?" While we'll examine the practicalities of the ISO process and the limitations of backwards compatibility, there is a lot of optimism to be had.
This talk assumes an intermediate level of C++ know-how and no prior knowledge of Rust.
---
David Sankel
David Sankel is a Principal Scientist at Adobe and an active member of the C++ Standardization Committee. His experience spans microservice architectures, CAD/CAM, computer graphics, visual programming languages, web applications, computer vision, and cryptography. He is a frequent speaker at C++ conferences and specializes in large-scale software engineering and advanced C++ topics. David’s interests include dependently typed languages, semantic domains, EDSLs, and functional reactive programming. He is the project editor of the C++ Reflection TS, Chair of the Boost Foundation, and an author of several C++ proposals including pattern matching and language variants.
---
Videos Filmed & Edited By Bash Films bashfilms.com/
KZbin Channel Managed By Digital Medium Ltd: events.digital-medium.co.uk
#Boost​ #Cpp​ #CppNow​

Пікірлер: 187
@ISKLEMMI
@ISKLEMMI Жыл бұрын
37:13 - So, this person essentially asks, "What if I don't want to RTFM or read the code?" You have to read one or the other (preferably *both*), no matter the language or the library. In a talk interrupted by lots of really silly questions/statements, this was the silliest.
@clv603
@clv603 Жыл бұрын
agreed. But in my experience it's not uncommon.
@Inuyasha463
@Inuyasha463 Жыл бұрын
I just got to that point in the video and had to pause for a minute because I was so dumbfounded.
@bluedark7724
@bluedark7724 9 ай бұрын
"I'm the kind of guy that doesn't read documentation." 😂 Well, how the hell did he learn how to program in the first place. I bet he doesn't read his code either.. it just is
@bluedark7724
@bluedark7724 9 ай бұрын
37:40 "is an important comment" he said. What not reading 😂
@greg_land
@greg_land 6 ай бұрын
I think the point of what was being said was "I don't want to have to read the manual to figure out how to use your library because you decided to be to "clever" instead of just doing things the simple and straight forward way."
@dexterman6361
@dexterman6361 Жыл бұрын
Man some of the audience just don't seem to get the point "YoU cAn dO THaT IN c++ juST dO so And so aNd MAcro aND CLass" like bro do you want the language to evolve or not? I get that you like the language but if you really like it, accept the flaws and let it evolve. Please, let modern C++ not be stuck in the past. There's a reason Rust is voted most fav language 3 times in a row.
@cthutu
@cthutu Жыл бұрын
6 times in a row
@kaplansedat
@kaplansedat Жыл бұрын
The attitude of the audience and the attitude of the presenter towards his personal views were very interesting. I think a language of unquestionable talent was killed or frozen by such a community. The presenter does not criticize, he just wishes we had it. i am a hobbyist programmer. wanna learn c++ or rust. Thank you to the audience at the presentation. They made my choice easy. Add a point to Rust.
@kaplansedat
@kaplansedat Жыл бұрын
they were so offensive in the beginning. therefore they could not object to 54:58 . because they set an example of the attitude mentioned. it was great. I don't know if it's predictive or detective for him to add this to the presentation. but I really liked the silence in this part. I have added this part to my favourites.
@RD-fb6ei
@RD-fb6ei Жыл бұрын
If you went to a rust crowd and showed off C++ features the reaction would be a thousand times worse. I can already hear it. Why would you need default parameters when you can just implement a dozen getters with for builder pattern?
@mishugrig6832
@mishugrig6832 Жыл бұрын
C++ has evolved into a scientific computer that most people don't know what all the buttons do.
@wackytheshaggy
@wackytheshaggy Жыл бұрын
If you want to know what the problem in c++ is, there is a guy, clearly passionate about c++ talking about cool stuff he saw somewhere else and more than half the comments from the audience are about how he’s wrong.
@mikeharry1799
@mikeharry1799 Жыл бұрын
Exactly what I thought.
@richardfairthorne7021
@richardfairthorne7021 Жыл бұрын
Despite the negativity, I found it encouraging. It showed that people were engaged and curious.
@jakearkinstall5313
@jakearkinstall5313 11 ай бұрын
​@@richardfairthorne7021 No, it showed that several members of the audience wanted to divert attention to themselves. Most of the comments weren't actual questions, and most of the actual questions were questions about aspects of the slides that weren't pertinent to the topic.
@DBGabriele
@DBGabriele 9 ай бұрын
This is common in all communities, try saying that C++ is better at something during a Rust conference or on Reddit's Rust community. Be prepared for a cascade of arrogance and sarcastic comments.
@julkiewicz
@julkiewicz Жыл бұрын
Incorrect pointer ownership bugs are uncommon (according to the talk). But hidden concurrency bugs are very very common and extremely hard to find in complex systems. And you cannot have proper thread safety in a system where there can be ownership issues. So actually the main advertised feature of Rust is in fact essential.
@thosteg
@thosteg Жыл бұрын
One interesting aspect that (I believe) was not mentioned was language editions. In rust it is possible to say that a particular component adhers to a specific version of the rust language. The component can then be defined that it must be compiled with a certain version of the language. That does not mean that all components require this version of the language. The same compiler is capable of building each component with its permitted language edition but that does not restrict the calling application in regards to the required language edition. This could enable deprecating certain language features while retaining backward compatibility. (Searchterm: "rust editions")
@kevindelnoye9641
@kevindelnoye9641 Жыл бұрын
There was a proposal for this in c++ if I am not mistaken, c++ epochs or something similar
@gowtham236
@gowtham236 Жыл бұрын
In c++, I think you can achieve that at a file level with compiler flags indicating the language version.
@fdwr
@fdwr Жыл бұрын
That's the one thing I really want because it would enable C++ to progress without the shackles while still maintaining compat. Surprisingly nothing in his list did I care about, and the one thing I cared about wasn't mentioned :/.
@thosteg
@thosteg Жыл бұрын
@@gowtham236 Indeed, though the difference is that c++ regularly only adds features, it does not (usually?) deprecate them in newer language versions. On the other hand, if something is warned about in a new version, that can help already, with "treat warnings as errors".
@brianmorin7022
@brianmorin7022 Жыл бұрын
A major complication is include files. C++ doesn't have a modern concept of internal vs external surface area the way newer languages do. This causes a lot of leakage of details, side effects, order dependencies, package nightmares, slows down builds and makes it really computationally expensive to do the sorts of editors we've become accustomed to.
@tylerbloom4830
@tylerbloom4830 Жыл бұрын
Great talk. I love to see C++ folks getting interested in Rust. A slight correction around 16:40, David said something that is not entirely true about pattern matching an enum. If you only care about one or two variants of an enum, you can still use match statements. You can just use a wildcard as your last branch of the match and just let it be a no-op. Alternatively, you can use destructuring with if-let to do something given a specific variant. Rust's destructuring ability also goes much further than that and is an incredibly powerful tool.
@peramoredellanalisi4341
@peramoredellanalisi4341 Жыл бұрын
Excuse me, why should C++ programmers get interested in Rust? Ain't it possible for you to continue to work on your Rust and for us with C++? What's wrong with that? Variety is beautiful, isn't it? A world with Rust and C++, each one with its strengths and weaknesses, is an amazing world!
@kilianvounckx9904
@kilianvounckx9904 Жыл бұрын
​@@peramoredellanalisi4341He just said he loves it when c++ folks get interested in rust. Never did he say every c++ programmer should switch over to rust or anything. As you say variety is beautiful, so people can like more than one language
@not_ever
@not_ever 11 ай бұрын
​@@peramoredellanalisi4341 I think you have misinterpreted Tyler Bloom's comment but, to answer your question, there are benefits to learning the basics of any language outside of C++. Each new language you learn gives you a fresh perspective on C++ and new ways of thinking and problem solving. Similarly, The Pragmatic Programmer recommends learning one new language a year. Rust is very quick and easy to learn when you have a C++ background, which makes it an idea candidate for busy people. If you can ignore all the pointless hostility towards C++ and proselytising by certain, frankly moronic, members of the Rust community, it is a very interesting language and probably will make you a better C++ developer.
@raianmr2843
@raianmr2843 10 ай бұрын
@@peramoredellanalisi4341 dude, rust was literally created by c++ folks. these langs and communities don't have the weird antagonistic relation that you think we do. like me, most rust folks are also cpp folks. this is like, literally how tech evolves and all
@kevindelnoye9641
@kevindelnoye9641 Жыл бұрын
There really should be some kind of community "suggestions" committee kind of like the cpp core guidelines. Half of the c++ ergonomic issues could be solved with minimal standardization efforts and agreeing on a common convention. - docstring annotation - test annotation - pitchfork layout - reviewing community libraries for a coherent API that will never reach the standard (argparse, Json, graphics, networking ...)
@julkiewicz
@julkiewicz Жыл бұрын
It sounds like perhaps they should first focus on making the C++ standard more easily changeable and faster to iterate on. Issues like having underscore breaking the syntax of existing code base should be avoidable. I really liked some of the ideas from Herb Sutter's CPP2 talk.
@chololennon
@chololennon Жыл бұрын
Great talk, but please, audience's comments at the end, otherwise it's awfully long and a mess for all of us who are not there.
@Mark-zk7uj
@Mark-zk7uj Жыл бұрын
15:20 Sum types are a fundamental ingredient! Who knew! Apart from ML programmers for 50 years
@ccgarciab
@ccgarciab Жыл бұрын
One day Hindley Milner will be the minimum expected from type systems
@obrsl
@obrsl Жыл бұрын
How do I downvote the audience?
@peterwmdavis
@peterwmdavis Жыл бұрын
26:09 “I’m gonna present an alternative, because, obviously.” lol.
@peterwmdavis
@peterwmdavis Жыл бұрын
and it gets snippier from there
@Aaron-o_o
@Aaron-o_o Жыл бұрын
Ikr
@get_youtube_channel_name
@get_youtube_channel_name Жыл бұрын
jeez the constant interruption made this talk unwatchable and it was not the speaker's fault
@eliduvid
@eliduvid Жыл бұрын
but the guy pushed through like a champ, and made his points clear
@bocckoka
@bocckoka Жыл бұрын
Linear types. Linear types are magic. You can do totally misuse resistant APIs with it, because you can use types as proof of work done.
@tuckerhart510
@tuckerhart510 Жыл бұрын
Great talk but wow some of the commentators really just wanted to hear themselves talk 😭
@kostaad
@kostaad Жыл бұрын
C# introduced pattern matching and it is every bit as great as you think it is :)
@dougrudolph5400
@dougrudolph5400 Жыл бұрын
the audience's comments juxtaposed to the community section of this great talk was a real time example displaying the lack of self-awareness in the C++ community. I've used C++ for many years, but fr it's so easy to have an egoless technical conversation with ppl in the Rust community. if you dare ask a question in an online C++ forum, there's more than 50% chance that you'll get a "well actually" type response, or just something vague and pedantic. and what's worse is that the people in this audience are doing this pedantic commenting, and they're the experts the lead committees of this language. the C++ community from the top down is rude. I'm happy to see there is someone deep in the C++ ecosystem that is trying to course correct the community, but god damn just watching this make me feel like the damage is already done
@AG-ld6rv
@AG-ld6rv Жыл бұрын
The audience was so absurd it made me laugh at times like the guy splitting hairs so much he corrected the dude when he said he worked on that paper 5 years ago ("Actually, it's 7 years" or something like that). That kind of thinking is useful in programming though as a program is full of technicalities, and the more you know about all of them, the more sense programming will make. They just need to cool it on the ego when it comes to irrelevant things like how old a paper is. I can't judge each and every comment made in the talk without knowing what their proposed C++ solution would look like (for all I know, some of these features really are quite easy to do in C++, and if that's the case, bringing it up during the talk was justified. Perhaps some people's concerns were well-founded.). As for your feeling attacked thing, I can't relate. In matters of performance (like business), politeness isn't needed. Efficient, understandable communication is more important. We are dealing with real, brutal realities when in comes to competition. You either know something or you don't, and being corrected isn't an insult. As long as the comment is true and adds to the asker's picture of programming in C++, it was actually a charity for a person to make a comment like that - not an insult. Of course, that is assuming the comment was accurate and that there was context for the information to be relevant. Personally, I love when someone gives me a detailed analysis of how I'm wrong. I just got free tutoring from an expert. We live in a very sensitive world where about 80-90% of people take being fallible as an insult. As a simple example, in most competitive, team-based video games, they have switched to showing people's ranks only AFTER the game concluded. I used to use that information to comprehend who deserves to lead the team, whose recommendations should be used. Unfortunately, tons of soft gamers took leadership / charity work / instruction / orders from someone who deserves to command as an insult. The prognosis is "teenager" (or man child), because successful adults understand power structures can exist and should exist sometimes. I guess they felt "attacked" as well. It's pretty sad, because now when someone gives a recommendation, you don't know if they're 4 ranks higher than you and you ought to take their advice, or if you're 4 ranks higher than them and should trust your own instincts. In a live match, there is no time to vet out each person's idea or derive optimal play on the fly, so you really need a measurement of authority in order to decide who to trust more and who to trust less.
@nathanbanks2354
@nathanbanks2354 Жыл бұрын
I'm coming from Python and dusted off my C++ to write a module. It has a memory leak somewhere. Now I'm planning to translate it into Rust since it needs refactoring anyway. This talk makes me think learning Rust is the right decision.
5 ай бұрын
This sounds more like you simply don't know how to write C++, I wouldn't blame the language that easily.
@IExSet
@IExSet 5 ай бұрын
A language itself wouldnt solve ur problems, neither in Python nor in Rust, if u doesnt have skills to use a tool, dont change the tool change ur skills or u'd be doomed to run in search of silver bullet for a rest of ur life ! 😂
@PaulTopping1
@PaulTopping1 Жыл бұрын
Great talk! One obvious question that the speaker didn't address (or I just missed it) is whether they would use C++ or Rust for a new project. I realize that that might have a complicated answer but it has to be asked.
@thelatestartosrs
@thelatestartosrs Жыл бұрын
At the start he essentially mentions he doesn't work on new projects
@laurenpinschannels
@laurenpinschannels Жыл бұрын
2:05 or so
@random_bit
@random_bit 9 ай бұрын
the answer is really, it depends… depends on, if your target platform has an LLVM compatibility or not. i tried compiling some rust for an unsupprted embedded platform this week and ended going the C route because I could not get the nightly compiler working on the rust side. and yes C, not C++, i have 0 interest in writing C++ in the current era, the community is simply that unapproachable.
@toddzankich9200
@toddzankich9200 Жыл бұрын
We can put the tests in the same file with doctest -- and in either traditional or BDD style. My manager also disagrees with me that tests should be right in the .cpp file for ultimate locality. A compromise is that, for every header xyz.h, and maybe xyz.cpp, I write a corresponding xyz.spec.cpp to test it. At least that way I don't have to change directories. (In the past, though, I have rigged up hotkeys to jump between corresponding h/cpp/test files.)
@toddzankich9200
@toddzankich9200 Жыл бұрын
Regarding the next point about Rust checking code examples in doc comments, code examples in doc comments might be an anti-pattern, anyhow, and WET (not DRY) if you already have, say, doctest BDD-style executable documentation directly in your .cpp file. Because then, a failure would be detected with known inputs, expected outputs, and the chain of BDD GIVEN/WHEN/THEN clauses provides context. (If code merely compiles in comment, but doesn't actually work correctly, that's not so useful.)
@thosteg
@thosteg Жыл бұрын
@@toddzankich9200 The doc-test is automatically run as part of the tests, it usually includes assertions that prove that the feature works as intended.
@dmitriidemenev5258
@dmitriidemenev5258 Жыл бұрын
@@toddzankich9200 To add more info to @Thomas Stegmaier reply, you can also use both declarative and procedural macros in doc comments. #[doc = my_macro_call!("...")] so macros can generate documentation.
@sneu420
@sneu420 Жыл бұрын
This dude's great...! Shoulda got more views...!
@voidwalker7774
@voidwalker7774 Жыл бұрын
He did a good job, convincing this C++ programmers to use Rust instead xD
7 ай бұрын
I don't think any C++ programmer would be switching, rather learning Rust as well. Why not.
@hellwolf4liberty
@hellwolf4liberty Жыл бұрын
the elephant in the room is that, C++ is not a single compiler, it is a standard compromising for max adoption among all its compilers. You'd get some of what you want here into one c++ compiler. It seems a wrong expectation to expect c++ standardisation be as nimble as other single compiler languages.
@talesvinicius598
@talesvinicius598 Жыл бұрын
But does the standard needs really 3 years minimum for every single feature? And there's some features that they don't even have a proper test before implementing it to the standard. The way the language is evolving has to change, it's not modern to have a "update" every 3 years anymore.
@AG-ld6rv
@AG-ld6rv Жыл бұрын
@@talesvinicius598 Evolving C++ is probably one of the hardest, complex, and intellectually difficult types of work a programmer can do. It's done by highly rational people. If they could iterate faster, they would.
@pierreollivier1
@pierreollivier1 5 ай бұрын
@@AG-ld6rv Yeah that's the problem the language is a pile of shit built on top of pile of crap, it's not good and unfortunately they don't want to break anything so they just add things nobody cares and uses.
@loganmcbroom9001
@loganmcbroom9001 Жыл бұрын
The actual best rust feature is that the community doesn't act like the audience at this talk. I'm quitting out halfway through this because it's been multiple straight minutes of people interrupting with pointless comments.
@Zex-4729
@Zex-4729 Жыл бұрын
Well, it's funny because most of them agreed Rust is better at the end.
@SealedKiller
@SealedKiller 6 ай бұрын
Wow, the community must be full of intellectuals!
@thevinn
@thevinn Жыл бұрын
Great talk, BUT.... "Make C++ more ergonomic" is super broad. I try to make my own libraries ergonomic and this is an enormous task. I spent 8 months designing Beast's body abstraction and it is still not ergonomic. One does not simply make a thing more ergonomic. Standard library interfaces are already pretty ergonomic, after all they were designed by the cream of the crop of knowledgeable C++ folks. To improve them further, one or more individuals would need to do a narrow, deep dive into a particular interface. Say, "filesystem::path" for example. It isn't easy. But we should try.
@Roibarkan
@Roibarkan Жыл бұрын
I agree. I’d also say that the notion of UB-NDR (undefined behavior, no diagnostics required) is non-ergonomic by definition and is quite prolific in c++
@raymundhofmann7661
@raymundhofmann7661 Жыл бұрын
The tools could also gain their ergonomy, for example: - Error messages / Diagnostics getting you quicker to where your compile problem is. - Helping with object pointer/reference life time by thread aware static analysis.
@bunpasi
@bunpasi Жыл бұрын
I used Beast and I really like it, but I think that ergonomics has to do with the interface as well. I've built a wrapper around your code with which you only need to call `Response = Request::GET(args)`. There is also an asynchronous version. A C++ library can be almost as easy as a JS library. If I actually need more options, I'll fall back at Beast itself. That's what is great about C++. You can get the best of both worlds.
@firexgodx980
@firexgodx980 Жыл бұрын
Here's a way to make it more ergonomic: don't require -m when you want to use the math library. If this trivial case can't be solved, C++ is irredeemable.
@oraqlle
@oraqlle Жыл бұрын
Is there a C++ WG21 ergonomics group being created or no in the works of doing so?
@andreicirstea8517
@andreicirstea8517 Жыл бұрын
Even if it were you wouldn't get much out of it. C++ committies are so inefficient. Game developers have asked for reflection since 2000's but are left hanging to this day. The situation is so bad that for my own game engine I had to basically create a macro parser that would go through my files and create reflection types.
@OptimusVlad
@OptimusVlad Жыл бұрын
Some of the audience members are so obtuse. "Python can parse comments to do that" -- Who cares? Do you not understand what the man is trying to illustrate?
@think2086
@think2086 Жыл бұрын
Just use `*` as wildcard. If it doesn't precede a variable name, it's not a pointer declaration or dereference. If it is not between two integral types, it's not multiplication.
@rafaelkss2009
@rafaelkss2009 Жыл бұрын
I dunno Circle, but that statement seems BOLD. I mean Ruby is pure meta programming basically, they revived MVC with it. Very bold statement, not saying it's wrong, just saying this is something.
@cthutu
@cthutu 11 ай бұрын
One of the super powers of Rust is Editions. This allows a newer version of Rust to be backward incompatible with a previous version but still be able to build code that uses both versions. The secret sauce to this is Miri which is an intermediate language generated from all versions of Rust code. This is then used instead of Rust code to build and generate the code. I think C++ requires a similar official system. Then a more modern C++ can be backward incompatible and so you can fix its issues. There is a complication with header files but perhaps that can be fixed with #defines such as #if __EDITION >= 2023 ...
@AttaKru
@AttaKru 10 ай бұрын
Cpp is backward compatible
@DBGabriele
@DBGabriele 9 ай бұрын
There the module, a good starting point to drop some old features.
@Soraphis91
@Soraphis91 7 ай бұрын
@@AttaKru that's not the point. the forced backwards compatibility in the language level is what makes it hard to modernize cpp while dropping old / error-prone stuff. editions are a way to allow for backwards INcompatibility (while still allowing to build the projects)
@iso-c
@iso-c 4 ай бұрын
@@AttaKru and CPP style do it, is very expensive for evolution.
@gubgubbubbub
@gubgubbubbub 3 ай бұрын
That 2015 proposal for variant was so, so much better than std::variant. There's no reason why std::variant shouldn't be implemented as a built-in type.
@ic3man5
@ic3man5 28 күн бұрын
I remember when learning std::cout almost 20 years ago and thinking "how is this better than printf"
@The1RandomFool
@The1RandomFool 11 ай бұрын
I just do programming as a hobby, and I'm glad that Rust is more approachable than C++. I moved from C++ to Rust because of it. Rust documentation is easy to read by comparison.
@ConceptInternals
@ConceptInternals 6 ай бұрын
1:01:17 We have to decide what we wanna focus on. It could be **what's the word he said here?**
@boffo25
@boffo25 Жыл бұрын
What is the difference between pattern matching and a switch case? If you assign the enum as const you have the same behavior.
@mishaerementchouk
@mishaerementchouk 10 ай бұрын
Switch works only with integral types. Pattern matching has a wider scope.
@a314
@a314 Жыл бұрын
All these features are in #DLang since 2010
@jonasPlatte
@jonasPlatte Жыл бұрын
Poor Raph Levien, people always get his name wrong 😅
@niklkelbon3662
@niklkelbon3662 Жыл бұрын
We dont need variant in language. We need syntax for creating a visitor. Something like overload set-lambda with better syntax
@user-zd5iw3fo6j
@user-zd5iw3fo6j Жыл бұрын
What did Bryce say at 1:06:06?! Also, great talk. Especially the inclusivity / ergonomics part. I've done C++ for years and now transitioned to Rust, and I'm doing way more complex things, significantly faster.
@paulosantana9607
@paulosantana9607 Жыл бұрын
Bryce said something about needing different people somewhere, I can't tell exactly where, but it sounds like MIT lol "Well maybe we need different people at the MIT then"
@pmcgee003
@pmcgee003 Жыл бұрын
@@paulosantana9607 basically in the standards committee/s
@KyleSmithNH
@KyleSmithNH Жыл бұрын
Really would have preferred if he didn't take any questions or comments during the presentation. Not a lot of useful discourse.
@cthutu
@cthutu Жыл бұрын
For me, personally, C++ is a legacy language. I've already replaced it with Rust. There's pretty much nothing I miss from C++. Professionally, C++ is not legacy yet as I work in the video game industry and it's alive and kicking there (unfortunately).
@isitanos
@isitanos 11 ай бұрын
Given the wealth of C++ middleware games use, there's no way Rust can gain popularity there given it can't comfortably inteface with C++. Something like Circle has a much higher chance of working since it has full interop and the ability to selectively enable features in different parts of the source. Circle is supposed to get a borrow checker pretty soon, so it would allow you to work in a Rust-like manner in most of your code while having classic C++ at the borders where you don't have the choice to interact with external libraries or your own legacy code. All we need now is commercial backing or an open-source community around a Circle-like language and we're in business, really.
@marcossidoruk8033
@marcossidoruk8033 9 ай бұрын
Rust is horrible for games, zig or odin or jai (if it ever releases lol) have much greater potential.
@kuhluhOG
@kuhluhOG 4 ай бұрын
21:36 You know, default is already a keyword. So why not just use that?
@paulmoore7964
@paulmoore7964 3 ай бұрын
'_' is not a wild card. It means 'i dont need the data' , rust will complain is you do not use a variable unless it starts with _
@simonhrabec9973
@simonhrabec9973 Жыл бұрын
Today I was coding in C++ a little and made a few simple typos along the way and desptie being able to find the issue quickly I was wondering why just replacing "cin" with "cout" has to create so many ugly error message lines including templates. Just how did we get to the place where we accepted that people should understand what is actually happening under the hood (with all the iostreams and operator overloading) just to be able to fix this small typo.
@indiesigi7807
@indiesigi7807 4 ай бұрын
My ide always points to the relevant message and big red would have appeared at your std::cin
@27182818284590452354
@27182818284590452354 Жыл бұрын
It's a shame that Circle extensions were too scary for the committee, they make the language a lot less masochistic. Or more “ergonomic”, I guess. Rust is a great place to adopt Python features for C++.
@PedroAlves0
@PedroAlves0 Жыл бұрын
The commentary about the committee being scared about security was very dismissive although that truly is an important issue. Also, Circle's meta programming model is broken for cross compilation which makes it a nonstarter.
@DerDoMeN
@DerDoMeN Жыл бұрын
I like the ideas but pretty pretty pretty please could we get a C++ version without attributes? I went through that Java attribute hell and I don't want to see that repeated in C++ again... I like the functionalities presented but if they'll be ported to C++ with attributes I'll call them not-worth-it no matter what.
@isitanos
@isitanos 11 ай бұрын
Too late, C++ has attributes like [[nodiscard]].
@hanabimock5193
@hanabimock5193 Жыл бұрын
What an annoying audience, they think they know more than the guy, then just go do the talk…
@pmcgee003
@pmcgee003 Жыл бұрын
cppnow is a small group conference, with experienced people, that encourages discussion over lecturing.
@jimhewes7507
@jimhewes7507 Жыл бұрын
Will C++ become a legacy language? Relevant to this might be Herb Sutter's talk on "Can C++ be 10x Simpler & Safer?" released after this video was released. Worth watching. kzbin.info/www/bejne/e33Ii3SBeLNnqrs He points out how the first C++ "compilers" were actually translators (e.g. Cfront) that translated C++ into C and then compiled the output with a C compiler. (I remember those days.) Maybe a newer C++ can do something similar while staying backward compatible.
@wi8shad0w
@wi8shad0w Жыл бұрын
The crowd is , irritating, Snobbish and very defensive .. let the man talk or even rant out all he wants.. Thats the only culture to progress ..
@piotrarturklos
@piotrarturklos Жыл бұрын
The crowd is engaged, that's good. It's composed of top professionals who want to get to the truth.
@vincentlextrait3092
@vincentlextrait3092 5 ай бұрын
I've been working on very large very long-lived C++ applications with a specific focus on performance, and no, variants are not everywhere. They are everywhere if you avoid inheritance, which is a fringe usage of C++ (granted, supported by the notable Alex Stepanov). Now as Rust does not have inheritance, variants (aka enums in Rust's parlance) are everywhere... It's poor man's inheritance. Replacing C++ concise virtual calls with match/switch does not sound very appealing to me. Replacing inheritance frugal memory layout usage with variants that take the maximum size even less. It used to be inventoried as the anti-pattern "type bloat".
@tiagocerqueira9459
@tiagocerqueira9459 4 ай бұрын
You don't replace virtual calls with enums. You can still do dynamic dispatch with trait objects.
@abdulshabazz8597
@abdulshabazz8597 Жыл бұрын
Rust features I want in my C++ is like Tesla Model 3 features I want in my Ford Mustang GT.
@szymoniak75
@szymoniak75 5 ай бұрын
meh, not really. Your Ford Mustang probably doesn't have a "press this for 2% extra engine power but risk violently exploding" button
@OlaInTheClouds
@OlaInTheClouds Жыл бұрын
Finally, Rust arguments not focusing on stuff nobody who know c++ would ever do. But I'm fine with C++ thanks. Interesting
@AbuAl7sn1
@AbuAl7sn1 Жыл бұрын
9:07 easily you can use shadowing let mut c = color::Red let c = 3
@binary132
@binary132 Ай бұрын
It’s funny that he mentioned “community” as a Rust language feature he’d like to have in C++. Rust’s community is incredibly dysfunctional. That is a major reason I avoid Rust and prefer C++.
@khuiification
@khuiification Жыл бұрын
Terrible audience lol. Dont have to agree with everythinf but sheesh, let the guy talk
@isitanos
@isitanos 11 ай бұрын
Nice to see an inclusivity discussion that's actually practical and aimed at including the masses instead of being just about giving in to demands from extremely marginal and polarized groups that are blind to anything except their own issues. The worry being that any working group founded will need to keep its focus on those goals or it risks being hijacked and polluted by those selfish and unsavory folks.
@ultimatesoup
@ultimatesoup 7 ай бұрын
C++ is still superior to rust though. Constexpr, consteval, constinit and their if counterparts are more powerful. Operator overloading to create nice dsl and syntactic sugar, postfix literal overloading, variardic templates, etc. I could go on and on about why cpp is better overall, but that's not to say their aren't nice features in rust I'd like to see
@pierreollivier1
@pierreollivier1 5 ай бұрын
I don't know Rust but I'm positive it's better than Cpp, Cpp is a very bad language, It's only used because well that's what everyone get taught at uni, and it's a performant language, but poor ergonomic, terrible standard, the tooling is especially atrocious. Compiler errors are terrible, unhelpful and it's slow to compile, Rust or Zig seems to be way more promising candidate than C++ and It's not going to change anytime soon as the people from the standard are really bad at their job too adding 50 ways of doing the same bloody thing in a more and more non intuitive way, just for 95% of developers to straight up ignore it.
@indiesigi7807
@indiesigi7807 4 ай бұрын
@@pierreollivier1 Well then don't use it? It's the greatest language ever imo.
@andremaha
@andremaha Жыл бұрын
Well, the audience is the prime reason C++ is going away. Just look at Linux kernel being rewritten in Rust.
@perghosh8135
@perghosh8135 9 ай бұрын
C/C++ differs from other languages ​​as it is about writing assembler code without having to write assembler. Other languages do not work like that, they are more tools/libraries used to work with existing functionality. This talk was only a prof of that, C++ should not try to mimic rust, instead - if you want rust then write libraries in C++ that makes c++ look like rust.
@heruhday
@heruhday 8 ай бұрын
Rust has inline assembly for x86 , x86-64, ARM, AArch6 , RISC-V, LoongArc. Ex: use std::arch::asm; // Multiply x by 6 using shifts and adds let mut x: u64 = 4; unsafe { asm!( "mov {tmp}, {x}", "shl {tmp}, 1", "shl {x}, 2", "add {x}, {tmp}", x = inout(reg) x, tmp = out(reg) _, ); } assert_eq!(x, 4 * 6);
@cataclysmwarshulduar
@cataclysmwarshulduar Жыл бұрын
I feel like C++ should have stuck with C++14 and then just create better tooling/infrastructure around it. The simple truth is that C++XX will never, ever, ever get as ergonomic as a modern language because it carries lots of baggage. There's simply no reconciling that. Instead, what happens is that we have something like std::variant that just feels half-assed and no one ends up really using it. It just feels bad to use compared to ADTs. Perhaps there should a frontend for C++17 like Carbon/Circle and innovate there instead of trying to wrangle 40 years of evolution into 1 coherent language.
@dagoberttrump9290
@dagoberttrump9290 Жыл бұрын
I like variants whats wrong with them?
@LyubomyrSemkiv
@LyubomyrSemkiv Жыл бұрын
I almost hate variants but just don’t have alternative and use all the time.
@simonfarre4907
@simonfarre4907 Жыл бұрын
Rust is just a modern programming language. It picked up the torch of what C++ really aimed to do, with it's c++11-14 and going forward. C++ was looking really, really promising last decade on it's ambitions. By the end of the 2010's, it became apparent that the steam, just had ran out. It's now just adding things nobody wants instead, taking _forever_ for the basic things, like std::format, std::print. I mean for christs sake, Andrei was a proponent of static if for the longest and having something akin to what D does. C++ template meta programming _isn't_ good and never will be, since it just massively *explodes* compile times. It's terrible and everybody agrees that it's terrible. It's unfortunate.
@firexgodx980
@firexgodx980 Жыл бұрын
1:07:15 "If you don't care about inclusivity for beginners, beginners aren't going to care about your language". This is so true. The first time I touched C++ and tried to import the math library, only to find out you have to add the -m as a compiler flag, I knew C++ was a terribly designed language. Because if such a simple ergonomic issue like that hasn't been fixed yet, what else is broken? I used it for 6 months after that, learned about all the other ridiculous ergonomic issues and never touched that clown fiesta of a language again.
@pastasawce
@pastasawce 4 ай бұрын
Worst questions ever from audience
@DerDoMeN
@DerDoMeN Жыл бұрын
Inclusivity is a double way road that is unfortunately quite these days often not taken by people that wish to be included... There's always the talk about including new new-bee members and random people but from my experience there are two types of people (yes generalising to just include the extremes as the rest - non extreme people - are more often than not a minority and not problematic): 1. the ones that are far too arrogant to even consider they're in wrong and look at the things from the opposing view (or even better 3-10 of the valid opposing views) 2. people that are really willing to get included, have an open mind and admit when they're in lack of knowledge/understanding Oddly enough the second group is in my experience the minority in programming world and are in my experience the only ones that do fit well and are the ones that should be included. Community is a messed up thing these days...
@AG-ld6rv
@AG-ld6rv Жыл бұрын
If I understand your points, I agree. The fact is different programming languages are harder/easier to use, and C++ is one of the hardest. Not only do the abstractions tend to remain in contact with the metal, you have to figure out which ones you want to pay for and which ones are too slow for your use case. Additionally, the language has some of the heaviest baggage out of any other language out there (e.g. supporting almost all of C even now). It might seem like there's an elitist club, but the reality is writing very good C++ (especially a library programmer or someone who does super high performance computing like for a trading firm) is some of the most challenging coding a person can get into. As a point of contrast, something like C# or Java removes tons of options, making it far easier to reason about and use (but also its best performance is around 2-5 times slower than tuned C++ code on average).
@unduloid
@unduloid Жыл бұрын
C++ features I want in Rust: Inheritance.
@ABaumstumpf
@ABaumstumpf Жыл бұрын
C++ pattern matching........... The current approaches seem so stupid. Don't introduce new keywords for an extension of existing behaviour. There is no reason to not just use the good old switch-case for this as that is already doing EXACTLY what we want to be more generic. Mailing-lists and IRC... the benefit of those is the vast history they have, their simplicity, reliability and ubiquity. Github is a company, discord is a company. They might fail at any moment, they might insert their own ideology at any moment. I am really not a fan of mailing-lists but they just work.
@Baptistetriple0
@Baptistetriple0 6 ай бұрын
the guy was exposing cool feature from another language that he would like to see in cpp because that's what you do when you like something, you try to improveit. and every comment of the audience was "hu you can do that in cpp, it's just very ugly and super not easy but you can, so I don't see the point" or other dumb questions like "how do you opt out?" bro that's not the point, the point is that feature is cool, how it is implemented is irrelevant
@pedromiguelareias
@pedromiguelareias Жыл бұрын
Rust is another «belle de jour» soon to age dramatically.
@xvnz
@xvnz Жыл бұрын
a good question after "will c++ inevitably be legacy?" would have been "will it outlive rust?"
@indiesigi7807
@indiesigi7807 4 ай бұрын
@@xvnz I kinda hope so. My skills will become even more valuable. Go rust!
@metaltyphoon
@metaltyphoon Жыл бұрын
What a horrible audience. Just keep ur questions or comments to the end.
@italoaugustooliveira9664
@italoaugustooliveira9664 11 ай бұрын
The pedantry of the audience is so annoying.
@Zex-4729
@Zex-4729 Жыл бұрын
Rust community is great, because they didn't come here to watch the whole video, instead to confirm they're beliefs, so they didn't watch to the end to see most of the audience liked Rust, and wanted to improve C++ from what they learning with Rust.
@michah3956
@michah3956 Жыл бұрын
Rust is the best programing Lang.
@cthutu
@cthutu Жыл бұрын
Depends what you're doing but I agree it's the best systems programming language today.
@ddddddddd345
@ddddddddd345 Жыл бұрын
Good talk, but the effort is too little too late. Whoever cares is already writing Rust instead of hoping that C++30 is going to be half as good as Rust is today. And self selection guarantees that people that stick around are of the old mindset and will keep the language on the current trajectory. Writing any new code in C++ instead of Rust is a malpractice. Maintaining a legacy codebase will increasingly be just a well paid niche, like Cobol is today.
@nono1271
@nono1271 Жыл бұрын
Rust is very much not a productive language with tons of half-baked features. Affine types alone isn't really an appealing pro over other languages with atrocious compile times and things being always broken anyway.
@raymundhofmann7661
@raymundhofmann7661 Жыл бұрын
AI was supposed to be as capable as a three year old kid over 50 years ago, and still AI cars need a human driver to supervise it and crash with too many fatalities. Rust is like AI. Grandiose claims by rust activists like you and miserable failure, plus a few useful ideas that will be picked up by what is successful.
@Cons-Cat
@Cons-Cat Жыл бұрын
C++ is _today_ a far far more powerful metaprogramming language than Rust, or any other systems level language for that matter. Rust needs to adopt more of C++, at least in-place construction. It's baffling that Rust still doesn't have that feature after years and multiple RFCs.
@piotrarturklos
@piotrarturklos Жыл бұрын
It's not malpractice. Rust is good for some things, for other things Rust is a meh solution and C++ is awesome.
@davidvernon3119
@davidvernon3119 Жыл бұрын
Do we really need to add another damn thing to c++. It’s time has passed. Why copy rust features into C++ when you can just migrate to rust?
@Zex-4729
@Zex-4729 Жыл бұрын
He can't that's why, he works on large code bases, you can't just migrate years of work to rust.
@MrAbrazildo
@MrAbrazildo Жыл бұрын
25:20, because it's verbose and slow. Of course a macro is much better. 1:09:35, are you crazy, people?! The best language becoming legacy?! WTF?!
@lalishansh
@lalishansh Жыл бұрын
I Don't like where this is going. I Love C and C++, C is very easy to understand, it helps understand machine, there language, C++ builds some essentials and extends it. about "std::variant" though it would look cool to use variant keyword, i won't like that because it adds a data member hidden away doing some special stuff. "match" may look like "switch" statement but it dosen't (isn't) seem that way. Also we are mixing compile-time behavior with runtime behavior. I can predict what belongs to runtime behavior and compile time behavior when it comes to C++, `where you draw the line in rust`. how can these things be allowed ? Creating Examples from comments is good idea though and C++ pre-processor especially needs work to be done but thats different than meta-programming. i rather set my bet on this than modifying C++. kzbin.info/www/bejne/e33Ii3SBeLNnqrs an interpreter for a language that builds up on C++ or even C, that's what C++ has always been at-least for me.
@mikeharry1799
@mikeharry1799 Жыл бұрын
That talk is really damning of C++ IMHO. It's become so complex that you'd only let a machine use it. It has all these powerful concepts and abstractions, but you need a cleaner language to translate from. And just the other day there was a paper (co-authored by Bjarne) which stated that it would never happen, because it's a different dialect, and it would never make it in to the standard.
@haystackdmilith
@haystackdmilith Жыл бұрын
Sorry mate, but what you say is gibberish. Memory safety issues is a known to be over 80% of all SIGSEGVs, crashes, and later exploits and CVEs… I boil inside seeing you say "It's not that big deal".
@stavinke
@stavinke Жыл бұрын
Do you mind saying which point is gibberish? The whole thing? You boil inside? Go outside and touch some grass my guy, relax
@mapron1
@mapron1 Жыл бұрын
I agree with him. Of all segfaults and memory bugs in my carreer I found 0 issues with C++ 'oh this variable referenced twice'. That kind of issue is really not a big deal.
@galchinsky
@galchinsky Жыл бұрын
80% of sigsegvs is 90s style code with C arrays without any automatic bounds checking even in debug build. It's not about modern c++ and modern c++ programmers
@mutuka
@mutuka Жыл бұрын
Use Rust then...
@brianmorin7022
@brianmorin7022 Жыл бұрын
@@mapron1 It's not a big deal up until the day it is. Or it's the underlying cause of a compute process having a shelf life before it either dies in a non-obvious way or needs a reboot. Give the sorts of systems the worlds needs us to build in cars, medial equipment, utilities, etc. having memory safety as a core feature is super-important.
@WilhelmDrake
@WilhelmDrake 11 ай бұрын
It seems whenever there is talk about inclusivity, it's always limited to including other people of privilege. It's never about including poor people.
@isitanos
@isitanos 11 ай бұрын
Not sure what you're getting at. To be proficient at systems programming (which is what C++ and Rust target) you need to be literate and trained in logic and maths, algorithmy, computer hardware fundamentals, and so on, so you pretty much need to have access to higher education. Even in so-called "privileged" countries there's a lot of illiteracy that would need to be addressed first, and then you get into sociology because a lot of the communities concerned have a deep-seated resistance to richer people trying to push education on them. At this point we've veered completely off-topic for this kind of talk, no sure what you were expecting exactly but it was obviously not realistic.
@user-zq8bt6hv9k
@user-zq8bt6hv9k Жыл бұрын
Unfortunately rust is a woke language with multiple half baked features, lots of good idea though
@skellious
@skellious Жыл бұрын
strange choice of phrase. what does woke mean to you?
@cysia3683
@cysia3683 Жыл бұрын
> multiple half baked features any example?
@raymundhofmann7661
@raymundhofmann7661 Жыл бұрын
And it seems to have an army of shills outnumbering productive users by a factor of 10 to 100.
@KohuGaly
@KohuGaly Жыл бұрын
@@cysia3683 Off the top of my head I can name a few: async rust. The end goal is that the standard library will define the common api for all the async-related stuff. All the async code, libraries and runtimes become generic over each other and be mutually compatible. The reality is, the type system is nowhere near even making such stabilization possible, due to several key features (GATs, generators, HKTs, specialization, async traits...). The ecosystem is fractured as fuck, the mutual compatibility is nonexistent. Unless you're on the happy path, your async code will eat your soul with problems that are currently impossible to solve with stable features. Const evaluation. It's really half baked, and in most cases unusable (yet). SIMD. Interfacing with exceptions is non-existent. Dynamic linking of generics. This is just stuff that needs language support directly to even exist. There are major gaps in the ecosystem too.
@Gabriel-nj3iw
@Gabriel-nj3iw Жыл бұрын
@@cysia3683 async
@ShanyGolan
@ShanyGolan Жыл бұрын
C++, please disappear. All hail rust.
Don't constexpr All the Things - David Sankel [CppNow 2021]
1:00:47
Learning Rust the wrong way - Ólafur Waage - NDC TechTown 2022
51:54
NDC Conferences
Рет қаралды 97 М.
😱СНЯЛ СУПЕР КОТА НА КАМЕРУ⁉
00:37
OMG DEN
Рет қаралды 1,8 МЛН
КИРПИЧ ОБ ГОЛОВУ #shorts
00:24
Паша Осадчий
Рет қаралды 6 МЛН
Delivering Safe C++ - Bjarne Stroustrup - CppCon 2023
1:29:16
Rust Lexer : Finished It!!!!
31:32
TheVimeagen
Рет қаралды 21 М.
C++Now 2017: Niko Matsakis "Rust: Hack Without Fear!"
1:18:45
When to Choose Rust • Tim McNamara • YOW! 2022
56:14
GOTO Conferences
Рет қаралды 16 М.
Is Rust the New King of Data Science?
15:38
Code to the Moon
Рет қаралды 130 М.
Don't use VSCode
35:31
PyCon South Africa
Рет қаралды 204 М.
C++23 - What's In It For You? - Marc Gregoire - CppCon 2022
1:00:40
Готовый миниПК от Intel (но от китайцев)
36:25
Ремонтяш
Рет қаралды 279 М.
📱 SAMSUNG, ЧТО С ЛИЦОМ? 🤡
0:46
Яблочный Маньяк
Рет қаралды 800 М.
Вы поможете украсть ваш iPhone
0:56
Romancev768
Рет қаралды 522 М.