In Metaprogramming Ruby, the author states that only a few languages, including Ruby, can manipulate themselves at runtime. What other languages besides Ruby can support this type of metaprogramming?
The specific quote I’m referring to is in the introduction on page xix:
In this book, I’ll stick to a different meaning of metaprogramming,
focusing on code that manipulates itself at runtime. Only a few
languages can do that effectively, and Ruby is one of them. You can
think of this as dynamic metaprogramming to distinguish it from the
static metaprogramming of code generators and compilers.
Most languages now days are moving towards providing that kind of functionality, but it’s generally not as “clean” as it’s in ruby.
All these languages have a lot of those capabilities (reference):
Other languages such as Java and C# (reference) have ways of inspecting and creating code at run time, but it’s not so “natural” as in those languages, and it feels a lot like a hack.