From: "Hal E. Fulton" Date: 2001-05-02T09:48:34+09:00 Subject: [ruby-talk:14521] Named parameters: Bright idea fizzles One day, a semi-intelligent caveman named Hal was thinking to himself about named parameters in Ruby. He knew about the hash trick, but felt a primitive longing for something more. He also knew about Named Parameters in a Later Version of Ruby, but he hadn't caught onto the "passage of time" concept yet. "Uh," he grunted as a ten-watt light-bulb appeared over his head. "I'll just do it this way, using instance_eval and a block." def myfunc(&block) instance_eval(&block) puts "#{a} #{b} #{c}" end myfunc {a = 3; b = 5; c = 7 } Needless to say, it did not work. He cast a furtive glance at his Cro-Magnon neighbors, hoping they would not kick him out with the Neanderthals. More appropriately, he tried eval instead. "Doh!" he said, anticipating Homer Simpson by millennia. "eval doesn't take a block!" Just for good measure, he tried Object.instance_eval, silly troglodyte that he was. Help him out. Is there some wonderful reason instance_eval takes a block, and eval does not? Is there some Nice Trick that would work here? Hal