Thoughts on Metaclasses - Herb Sutter - Keynote [ACCU 2017]

  Рет қаралды 17,768

ACCU Conference

ACCU Conference

Күн бұрын

Пікірлер: 43
@JohnCLiberte
@JohnCLiberte 7 жыл бұрын
this can't happen soon enough :( we must have this now!
@llothar68
@llothar68 7 жыл бұрын
Maybe in C++26. Serious, the language moves so slow with really new ideas.
@anfield6321
@anfield6321 7 жыл бұрын
Herb comes from a beach every time he gives a talk?
@poserise
@poserise 7 жыл бұрын
Yeah, Nick Slaughter's styling :)
@FooBar89
@FooBar89 6 жыл бұрын
no, he's just that awesome :)
@sephirostoy
@sephirostoy 7 жыл бұрын
My eyes shined from the second slide to the last slide and and even more after each one. This presentation sounds to solve most of the C++ lacks and more. Definitively I want it tomorrow.
@jaysistar2711
@jaysistar2711 7 жыл бұрын
Unreal Engine 4 and Atomic Game Engine both have script bindings that need a side compiler. Adding a side compiler to a build system is rarely trivial. This proposal would eliminate the need for those side compilers. Also, Protocol Buffers, and CapNProto could eliminate their side compilers. Object DB mapping, and general serialization benefits as well.
@kamilkoczurek484
@kamilkoczurek484 7 жыл бұрын
Indeed, in 10 years we may see Qt become actual c++ library instead of language extension. //Wow, it's actually in that video. :0
@guillaumepiolat5963
@guillaumepiolat5963 7 жыл бұрын
This is basically what we have in D for years
@kamilkoczurek484
@kamilkoczurek484 7 жыл бұрын
I use D sometimes, how is that feature called? Never heard 'bout that.
@guillaumepiolat5963
@guillaumepiolat5963 7 жыл бұрын
It's the combination of static (and runtime) reflection, CTFE, static foreach, static if, string mixins, and traits. For example checkout dproto which compile Protocol Buffers at compile-time, std.regex, pegged...
@seditt5146
@seditt5146 4 жыл бұрын
If I am not mistaken LLVM on a relative scale anyway does make side compilers Trivial. Trivial as possible for what it is but still.
@TheJanhalsema1
@TheJanhalsema1 7 жыл бұрын
I can't wait to use this, this is so amazing :)
@seditt5146
@seditt5146 4 жыл бұрын
While I kind of want this, We have to ask ourselves. Will this make our code shorter? Right now C++ can do pretty much anything your heart desires, you can do whatever with the language. Is this reflection necessary or order to write code faster. If it does not make our code writing faster we should not implement it because C++ has been getting more and more stuff that is bloating the language and making writing code longer in some cases. These Meta classes while they seem cool and my most recent project could have likely used just a thing as I attempted to abstract out function pointers to store different signatures all in the same array. Reflection could have helped but I managed to do it anyway and not sure this sort of stuff is worth the bloat. Idk, I guess we will see. Most peopple have not even learned many of the features of c++17 yet and we are almost into 2020
@kwanarchive
@kwanarchive 7 жыл бұрын
I want this yesterday.
@jimhewes7507
@jimhewes7507 7 жыл бұрын
Although it makes the code _look_ simpler, will such code really be simpler in practice? For example, if you don't know for any given class whether variables are public or private by default, then you will always have to go running for documentation to find out. Whereas in good-old normal C++ I know they're always private. With metaclasses you get power because you can change the rules, but then you don't always know what the rules are when looking at any given code. True? I haven't fully ingested all this yet, and no doubt metaclasses are a good thing. But as far as being simpler I'm not sure yet. Anyway, a first impression.
@cH3rtzb3rg
@cH3rtzb3rg 7 жыл бұрын
But if you write `typedef std::pair Point;` vs. `value Point {int first; int second; };` where is the difference between looking up how `std::pair` is defined and how `value` is defined? Of course you could define insanely stupid metaclasses, but you can also define stupid classes. And if you code something which is already simple with a standard C++ class/struct, there is no reason to hide this somehow in a metaclass.
@jimhewes7507
@jimhewes7507 7 жыл бұрын
Yes, if there is encapsulation going on and you need to know what's in there you have to look it up. But there is now an additional level. If I'm reviewing a class definition, I still don't know the rules. I don't know what extra functions might have been added, what various defaults are, etc. So I'd also need to look at the metaclass definition. As shown in the slide at 22:00, you are getting to define a little more of the language itself which the compiler normal defines. So when you are looking at code you have to ask yourself, "what 'language' am I looking at now?" What are the rules here? I noticed that even the volunteers had some trouble. In the slide at 15:00 they had trouble guessing whether the members of Point were public or private. They gave different guesses. I understand that Herb's intention was to get them to say what they _wanted_ or _expected_ the defaults to be in this particular case. But you can't know until you also look at the metaclass definition and that was not simple at first glance. This would be good and probably simpler _within_ a company where you were familiar with the metaclasses you've built. But simpler in the wild? I guess I'll have to use it for a while to see if that's true.
@Runoratsu
@Runoratsu 7 жыл бұрын
Yep, this is my biggest concern with this as well. Maybe it won't be the same for completely new programmers, but if I look at something that looks like a class, I'll begin to parse it as a class (in my head), and might then, from time to time, expect different behavior than what will be produced. It just makes the code so much more implicit. With inheriting classes I at least see: Oh, there's a parent class, I should look into it to see its methods! At least some kind of identifier (attribute/whatever) for metaclass types would be good imho.
@r4uz
@r4uz 7 жыл бұрын
Any class today, if it has base classes, you'll have to study the base classes first to fully understand the limitations of the derived class. For classes "coming from" a metaclass, it means you'll have to study the metaclass first to understand its limitations. I don't see this as a negative.
@SolidAir54321
@SolidAir54321 Жыл бұрын
Considering the Rust derive macro I'm warming up to metaclasses.
@RobTheBlob
@RobTheBlob 7 жыл бұрын
Really pleased to see this direction being explored. I do wonder why limit it to metaclasses? Is is not possible (in theory) to apply this type of transform at other scope levels - notably namespaces and methods, to allow similar transformations. For example, it could enable writing a test class, with test methods - each generating the appropriate scaffolding to support a test runner or test explorer tools.
@videocortex-io
@videocortex-io 7 жыл бұрын
Mind blowing!
@lividlin4142
@lividlin4142 7 жыл бұрын
nice talk. encapsulation is a double sword, you put everything in blackbox, hard to figure out code idea at first glance.
@jleahr
@jleahr 7 жыл бұрын
Metaclasses...I want it, I love it, We need it
@jaredmulconry
@jaredmulconry 7 жыл бұрын
The end result is cool. The mechanism, whilst a little clunky, is in a good direction. Having static reflection will be the first step. Follow it with this hook-in point makes sense because I see *huge* issues coming up with the grammar, especially around namespaces, scoping and what it means to have one of these things in template declarations, etc. Basically, everything that the keyword 'class' has to deal with, so must anything you make with this facility. Good luck :p
@jstock2317
@jstock2317 7 жыл бұрын
Mmmm, Object Oriented OOP This talk will be legendary, great stuff!
@Sobbayi
@Sobbayi 7 жыл бұрын
This is so amazing... I'm feeling really excited about this
@paulcook8211
@paulcook8211 4 жыл бұрын
This is pure genius.
@henrymiller1820
@henrymiller1820 7 жыл бұрын
I want std::interface in the library for C++20, even if the syntax to do any other interface needs to wait for a latter standard.
@mrlithium69
@mrlithium69 7 жыл бұрын
This was way over my head but it looks good - if you can understand it.
@k6l2t
@k6l2t 6 жыл бұрын
If Jai gets released before C++ adds reflection, C++ is going to get dropped from the game development industry.
@hys420
@hys420 7 жыл бұрын
As always - exceptional
@draguin
@draguin 7 жыл бұрын
The way Herb asks the questions and presents the features is biasing judgement so much
@CharIie83
@CharIie83 7 жыл бұрын
is it necessary to reinvent the wheel every time?
@EgnachHelton
@EgnachHelton 7 жыл бұрын
Brilliant!
@simivb
@simivb 7 жыл бұрын
The first 18 minutes are the worst way to present something that I have ever seen. he puts two people on stage an plays "guess all the awesome things about my stuff" with them. WHY?? Whats it with the "what if I told you..."?
@seditt5146
@seditt5146 4 жыл бұрын
I feel like these people are lying about some stuff and I am only 15 minutes in. Give it a real review already else they are going to keep pushing crap that don't make sense. The Interface they obviously thought was crap but then soon as he said that is the proposed standard they changed their tune as though they wanted it. Which means we get trash because people giving them input are not truthful because they are star struck.
@ronniecorbett
@ronniecorbett 7 жыл бұрын
Fantastic!
@acmdz
@acmdz 7 жыл бұрын
actually praying for this
@andoalon
@andoalon 7 жыл бұрын
I need this so hard
@georgeplaintiff819
@georgeplaintiff819 7 жыл бұрын
I also see equivocation fallacy here, if something *looks* simpler, it doesn't mean it is. When Dijkstra said that every problem can be solved by introducing another level of abstraction, he didn't mean it in a positive way, piling abstractions is a bad thing. This would also introduce more dependencies within code base and make it harder to move code between projects, if it won't spawn a bunch of "sub-languages" altogether... The idea isn't that bad in itself, it's just that there are many ways it can be abused.
@piotrarturklos
@piotrarturklos 7 жыл бұрын
If you think this feature is powerful, check out D language in which you can generate source code as a **string** at compile time and tell the compiler to treat it as a part of compiled source code. Its not macros, it uses regular, very readable D code to generate the strings. Combined with compile-time introspection (also in D) and powerful template system it enables creating special classes like in the video and much more. The metaclasses proposed in this video are quite limited because you can only define a class this way. In D you can generate any expression or statement (another issue is that often you don't even need to generate code as strings because D templates are very powerful). As an extreme example, in D you can define class Parser by writing formal grammar as a string in source code.
Lock-free programming with modern C++ - Timur Doumler [ACCU 2017]
1:31:34
Help Me Celebrate! 😍🙏
00:35
Alan Chikin Chow
Рет қаралды 52 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 23 МЛН
CppCon 2016: Jason Turner “Practical Performance Practices"
1:00:29
CppCon 2017: Herb Sutter “Meta: Thoughts on generative C++”
1:47:45
Argentina's Libertarian Experiment
11:33
QuickLearn: AI Makes You Smarter
Рет қаралды 15
CppCon 2015: Herb Sutter "Writing Good C++14... By Default"
1:29:06
C++ Weekly - Ep 400 - C++ is 40... Is C++ DYING?
20:51
C++ Weekly With Jason Turner
Рет қаралды 30 М.
CppCon 2016: Ben Deane “Using Types Effectively"
55:20
CppCon
Рет қаралды 46 М.