Flippancy or Ignorance?

September 6, 2012 at 10:20:46

From Paolo Perrotta, Metaprogramming Ruby, Pragmatic Programmers, 2010, p. 114f.:

You can detach a method from its object with Method#unbind(), which returns an UnboundMethod object. You can’t execute an UnboundMethod, but you can turn it back into a Method by binding it to an object… Good luck finding a good reason to use this exotic stuff in real life!

Okay, so you explicitly dismiss UnboundMethod as useless — when it’s the basis for one of the most flexible forms of monkeypatching, as well as the all-important BlankSlate class? I can’t tell whether this is because you’re deliberately being shallow (to spare the reader the technical details) or you’re merely ignorant of UnboundMethod’s importance, but it hardly matters, because I just threw your book out the window. In a book that claims to be about metaprogramming Ruby, this sort of omission-by-dismissal is unforgivable.


This page prepared February 14, 2014 by Matt Neuburg, phd = matt at tidbits dot com, using RubyFrontier. RubyFrontier is a port, written in the Ruby language, of the Web-site-creation features of UserLand Frontier. Works just like Frontier, but written in Ruby!
Download RubyFrontier from GitHub.