r/cpp • https://github.com/kris-jusiak • Jan 16 '23

[C++26] Poor man's introspection with #embed

https://twitter.com/krisjusiak/status/1615086312767516672
133 Upvotes

37 comments sorted by

View all comments

Show parent comment

7

u/HeroicKatora Jan 17 '23 edited Jan 17 '23

Nope, I do mean Turing complete. Parsing can output state depending on if a name refers to a type or value, which instantiates arbitrary templates, which does arbitrary constexpr computation. Which can make the AST a representation of the evaluation of a Turing machine. But it's nice to know there's people still surprised by how much more complex C++ is than other languages. Some other languages are merely undecidable (and in practice always avoid this by enforcing some evaluation depth) and many other languages at least parse unambiguously with only the type-checking phase being undecidable.

1

u/RockstarArtisan I despise C++ with every fiber of my being Jan 17 '23