Hi -- On Sun, 7 Sep 2008, Ryan Hinton wrote: > I get a core dump when executing the following code. > > class Bob > ['hi', 'hello', 'howdy', 'goodbye'].each do |mname| > instance_eval <<-EOF > def #{mname} > puts #{mname} > end > EOF > end > end > Bob.hi > > I get the same behavior when using eval instead of instance_eval and > calling "Bob.new.hi". I know that the code isn't valid, but a core > dump seems inappropriate (maybe a SyntaxError exception?). And my > Ruby interpreter is a little old. > > $ ruby --version > ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-freebsd6] It's actually not a syntax error; it's infinite recursion, because you've got: def hi puts hi end so it calls itself. So it should give you this: (eval):2:in `hi': stack level too deep (SystemStackError) or equivalent. Can you try it with a more recent 1.8.6? David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails January 12-15 Fort Lauderdale, FL Advancing with Rails January 19-22 Fort Lauderdale, FL * * Co-taught with Patrick Ewing! See http://www.rubypal.com for details and updates!