3 ms·
This is pretty much the same as @synthesize in Objective-C. I think a better example of metaprogramming might be the usage of method_missing in Ruby, or, say,
by FuzzyDunlop 14y ago
This is pretty much the same as @synthesize in Objective-C.
I think a better example of metaprogramming might be the usage of method_missing in Ruby, or, say, __call and __callStatic in PHP, which all allow one to do interesting things with non-existent method invocations.
- cubicle67 14y agoI'd argue that method_missing isn't metaprogramming at all. What about ActiveRecord (Rails' default ORM)? That makes great use of code-writing-code to generate a ton of methods on your class all based on db fields.