4 ms·
my feeling is: When you are using method_missing hacks to build an object that watches what methods get called on itself, you will eventually get into trouble.
by jes5199 14y ago
my feeling is: When you are using method_missing hacks to build an object that watches what methods get called on itself, you will eventually get into trouble. There are enough things in Ruby that aren't really methods, like the != operator, which won't do what you expect, and you will produce very confusing bugs, because the code will look correct. The hours that I've seen wasted because people tried to use `x.should != y` in RSpec is enough time to learn a language that supports hygienic macros.
Writing these libraries is a great way to learn about ruby, but avoid them in production - there's usually a safer way. (For a simple example of dangerous-methodmissing-hack verus sane metaprogramming to accomplish the same task, compare http://andand.rubyforge.org/ http://andand.rubyforge.org/ with http://api.rubyonrails.org/classes/Object.html#method-i-try http://api.rubyonrails.org/classes/Object.html#method-i-try )