it just the function constructor, or what else qualifies? Is eval metaprogramming?
Great question I'm curious to know this too
I am not a pro at either JS or Metaprogramming but I think I can explain it a little, @TRGWII please correct if anything is wrong. Meta programming is basically writing programs capable of writing other programs, or doing stuff like reflection and introspection. So yes eval is Metaprogramming. Of type called code generation. A large part of Metaprogramming is also to be able to get information from objects and being able to change their workings. In JS you have function.name, function.call and other such functions that serve this purpose. Also we have others like typeof, instanceof, delete. And since ES6 we also have Reflect and Proxies which allow for multiple types of code Reflection.
Metaprogramming doesn't mean anything different for JS
Also I forgot about Symbols they can also be used for Metaprogramming.
Обсуждают сегодня