From: Mike Owens Date: 2013-03-16T13:53:52+09:00 Subject: RubyVM::InstructionSequence compiling and loading I recently came across "An Amateur Smalltalk User's Observations on Ruby Object Model and Bytecode" (http://www.slideshare.net/kstan2/smalltalk-and-ruby-20121208-15542185). I tried his example of enabling iseq_s_load(). I stumbled across a simple case where the loaded compiled code does not work as the original compiled code, specifically: source = %q{ args = {} args['q'] = 'test' args.to_a.collect {|x| "#{x[0]}=#{x[1]}" }.join('&') } orig = RubyVM::InstructionSequence.compile source loaded = RubyVM::InstructionSequence.load ins.to_a orig.eval other.eval # <- Exception The first eval works. The second eval throws an exception: :in `': undefined method `join' for # (NoMethodError) The result of the first collect method is (and should be) an Array. However the second is producing an Enumerator. I was wondering if anyone could explain why this is the case? -- Mike