in SV, generate constructs are exactly this concept and have reduced the need for macros significantly, but we still can't quite get rid of them. but at least for me they are pretty rare.
I really like what Zig and C++ are doing with `const`.
https://ikrima.dev/dev-notes/zig/zig-metaprogramming/
Have you looked at Spinal?
https://github.com/SpinalHDL/SpinalHDL
https://spinalhdl.github.io/SpinalDoc-RTD/master/index.html
edit, I see in your post history that your first submission was on Prosser's macro expansion. https://www.spinellis.gr/blog/20060626/cpp.algo.pdf :)
spinalHDL: yes, also interesting. although honestly, i really prefer SV. it's a shame that the language has become so complex, but a synthesizable subset still ends up being the best thing for me to efficiently describe hardware. what they did with generate() and parameterization (borrowed from VHDL?) is very nice. it's far, far, better than C++ templates for an analogous purposes. i very rarely need to use `if, `define in SV nowadays.
cpp: oh yes, i'm a nerd about languages/macros/meta-programming/etc.