Quite enlightening talk. Thank you Stephan and CppCon for this one.
@eLBehmo4 жыл бұрын
15:37 - does someone know of a case where type information flows backwards? What does he mean by this?
@davidkatz10172 жыл бұрын
If anyone's still interested in the answer: ``` auto a = true ? std::nullopt : std::optional{42}; ``` I'm not sure if this is exactly what Stephan had in mind. The first part of the ternary doesn't tell us the type of the expression (well, it's nullopt_t, but that's not helpful). The second part makes it optional. So type information sort of flows backwards.
@cppsage6 жыл бұрын
Slide 16! Where is Enterprise? :)
@PixelPulse1686 жыл бұрын
Well, with great power comes great responsibility.
@origamibulldoser16185 жыл бұрын
With great power comes great fuck ups
@TsvetanDimitrov19766 жыл бұрын
We definitely need to have a warning about it if CTAD could potentially select the wrong template specialization.
@juliean1236 жыл бұрын
nice talk!
@mapron16 жыл бұрын
On "Comittee Grill" one of the members (Titus afair) said he regret CTAD exists in standard. Why it could consider evil?
@timseguine26 жыл бұрын
My guess would be because it introduces yet another specialized syntax in order to specify the deduction rules. For me though I see it as necessary for consistency and ease of use with concepts and generalized auto.
@mapron16 жыл бұрын
Good point. Though, I don't think comittee member could say "I wish it wouldn't exists" only for "new syntax".
@TheFojar6 жыл бұрын
Titus gave his reason for disliking CTAD as that it was rushed into the standard without enough deliberation and tuning. I imagine if it was better-implemented, it wouldn't be as disliked.
@mapron16 жыл бұрын
I remember that. But I wa curiuos for objective reasoning, not the process' issues.
@timseguine26 жыл бұрын
I can understand his point of view. I do have the intuition that this could end up like ADL(which is in a lot of cases good) with weird unintended corner cases that unfortunately show up in reasonable usage. I mean C++ syntax is a minefield and this probably didn't make that better.
@anonytube16796 жыл бұрын
It weirds me out that he says "shared putter, stood vector, int star" instead of: shared pointer, standard vector, int pointer. Who talks like that?
@okaminess6 жыл бұрын
He's speaking in acronyms.
@ccreutzig4 жыл бұрын
A lot of people in C++ conferences talk like that.
@juliean1236 жыл бұрын
But i should have logged myself out, or shut down my computer at least before i leave. Nvm i am always hasty and have no focus.
@noxabellus6 жыл бұрын
I think we're reaching peak insanity here. You need expert level knowledge to do anything in C++ safely these days. The level of generality in the STL is a cancer spreading across the whole language. I'm not a big fan of Rust but its a good example in this case. It doesn't need any of this shit, because they don't try to make every type work for every situation. They pick a sane subset of problems to solve. If the type you're using doesn't solve the problem you have, you make a new type; you don't stick 15 template parameters on it. If you simply set sane limits, you don't need a whole new syntax to deal with the overly generic nature of everything.
@informant096 жыл бұрын
Git gud.
@noxabellus6 жыл бұрын
@@informant09 I did. Its dealing with other people's lack of understanding that is problematic now
@seditt51465 жыл бұрын
Yeah, its as safe as its always been, its people inventing stuff to fix errors that happen from people that don't know what they are doing which creates more stuff that more people don't know how to use so they need to fix that to make it so more people can use it and that can be safer....... ..er......err..... If youngins would have just git good from the start we would not have most of this shit but instead the belief now is this stuff is what makes you good and that is why so many programs lag these days when computers 20 years ago could have kept up with the same task. Its also why my chrome browser is using like 4 GB of data and climbing for a 5kb web page.
@chevlonmacguinstudios6 жыл бұрын
Geez and I thought c parallel programming was crazy, this is messy as fuck completely new layered abstraction over general pragraming.
@LunarLambda6 жыл бұрын
C++ should have type inference, aka almost always auto but without writing "auto", or replace it with something else, like "var v = vector { 1, 2, 3, 4 }; a = array { "hello"s, "world"s }; p = pair { true, 400 };
@sephirostoy6 жыл бұрын
auto is all about type inference. What's wrong with it?
@pitri_hub6 жыл бұрын
I'm glad that auto is there, because I would like to be able to differentiate between the declaration of a variable or if the variable just gets a value. That's what I always hated about languages that can just "use" variables. If you declare it, you explicitly tell the reader "This is the place where I need the variable". It makes the code more expressive. And expressive code is something desirable. If you can just "use" a variable without declaration, you never know if this place was the first usage of the variable without having to search through the whole function. And even if you don't find it in there, who guarantees you that the variable isn't declared outside of the function? Maybe in a class or as a global variable? Just think about it, and the lifetime of variables. Not needing to use auto for a declaration would have major consequences. And I would also like to ask you: What's wrong with auto? Why are you suggesting it being renamed to var or something else?
@alcesmir6 жыл бұрын
#define var auto
@sephirostoy6 жыл бұрын
@@alcesmir #define let const auto
@isodoublet5 жыл бұрын
"v = vector { 1, 2, 3, 4 };" GTFO with that javascript shit.