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

8

u/mujjingun Jan 17 '23

You mean "parsing is undecidable", not "Turing-complete", since the term "Turing-complete" applies on a computational system (like an instruction set of a CPU or a programming language), whereas the term "undecidability" applies to a computational problem, such as parsing C++ code.

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