Thoughts on Metaclasses - Herb Sutter
summary
Proposal adds meta classes on top of assumed reflection and compile-time programming, letting library code rewrite class declarations (interfaces, value types, flag enums, properties, Qt-style signals/slots or COM/CX shims) at compile time. An alpha implementation for GCC (thanks Andrew Sutton) runs on Godbolt/Compiler Explorer, produces human-quality diagnostics, and successfully compiles several examples. Work spans about two years; goal is fewer hardwired language features and more testable, sharable libraries that replace some vendor extensions.
AI-written summary · about
chapters (40)
- 0:00Intro
- 7:15Errors
- 8:02Interface
- 10:00Requirements
- 10:50Interfaces
- 12:13Metaclasses
- 17:53Usability Studies
- 18:50What are Metaclasses
- 21:07C language rules
- 22:25Write your own code
- 22:41Its a hook
- 22:58Not a mutable language
- 23:13You cannot change the grammar
- 23:44All classes are classes
- 24:57User code
- 26:46Source code
- 28:02C vs C
- 28:44C vs C Implementation
- 29:09Alpha Implementation
- 29:20C Demo
- 30:20Compiler Explorer
- 30:54C to C
- 31:36Compile
- 32:29Error interface
- 32:41Data members
- 33:20A strong foundation
- 36:05Value
- 39:29Class Pair
- 40:21Class Pairs
- 42:12Flag Default Constructor
- 42:38Declaration
- 43:17Hierarchy
- 45:06bug
- 46:08print labels
- 49:45default on metadata
- 50:34template instantiation
- 51:18segway
- 54:46Cute
- 56:16Cute Mock
- 57:39Sample Cute Mock
related talks
01h 48m“Meta: Thoughts on generative C++”
59mMeta++: Language Support for Advanced Generative Programming
01h 27mC++ Reflection - Back on Track
01h 08mReflections: Compile-time Introspection of Source Code
01h 00mDynamic Polymorphism with Metaclasses and Code Injection
01h 10mReflection Is Good for C++ Code Health
01h 04mWelcome to v1.0 of the meta::[[verse]]!
01h 39m“Thoughts on a more powerful and simpler C++ (5 of N)”
