I once came across this awesomely weird bit of Rails code; it was a method that called itself and then redefined its body on the second call.
I've been telling the tale of the "recursive method that wasn't" ever since, but couldn't remember where in the codebase it was and was too lazy to go dig it up again. I recently came across a post about the exact same method on Brian Guthrie's blog - see for yourself. Incidentally, I agree with Brian - this kind of code is unnecessarily complex and is on the path to the meta dark side.
Post a Comment