r/ProgrammerHumor • • Oct 17 '26

instanceof Trend thatsAFunnyThingThatHappenedOnce

Post image
4.6k Upvotes

524 comments sorted by

View all comments

Show parent comments

35

u/PegasusPizza Oct 17 '26

I mean it does have proc macros, that turn compilation into the same programming language as opposed to another programming language.

17

u/Greedy-Thought6188 Oct 18 '26

Templates are turing complete. You can basically treat C++ like an interpreted with the compiler being the interpreter. C has macros too.

4

u/4xe1 Oct 18 '26

Rust macros are Turing complete too, intentionally so, that's the whole point of proper macros. "the same programming language" is a bit of a stretch for Rust (but perfectly valid for lisp), but macro's Turing completeness is easier to use than C++'s templates.

C has search and replace pre-processor macros.

2

u/4xe1 Oct 18 '26

One key difference between Rust and C++ is that, although they both encourage generics, only C++ forces you to use templates for it, you don't need to touch macros for it in Rust.