~/talk

Reflections: Compile-time Introspection of Source Code

Talkat CppCon 2019 · 2019-09-15..09-20· [compilers-and-language-design]
links:none on file
slides:none on file

Proposal: a static reflection system for C++ that exposes source-level declarations as a single compile-time meta value, implemented in a clang fork and demoed on Compiler Explorer; it uses a reflects operator to get meta handles, consteval/immediate functions as the compile-time boundary, and expansion statements plus reification (value_of/type_name) to generate code. Examples: enum-to-string, structural hashing, and a partial runtime introspection library (nemesis); it mostly works but has compile-time performance tradeoffs (user-defined types slow some compilers 3–9x) and some examples require the experimental compiler.

AI-written summary · about

  1. 0:00Introduction to static reflection
  2. 9:49Why static reflection matters
  3. 16:07Stringification with reflection
  4. 33:11Structural hashing example
  5. 45:53Runtime introspection demo
  6. 55:27Pattern behind reflection use
  7. 57:32Final thoughts and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.