From: Intransition Date: 2010-06-20T06:10:02+09:00 Subject: Module vs Binding Evaluation I am confused by the difference between using module_eval on a module, vs. using eval on a binding extracted from a module. Have a look at this gist: http://gist.github.com/445263 When run, it produces: s2::X uninitialized constant #::X s3::X uninitialized constant #::X Other than the lack of a local scope (which is not being used), why is s1 and s2 behaving differently? I would expect the results to be equivalent. And even more confusing to me, how is it that s3 can see s2's method definitions even though it's a whole new module!? Note the 'extend self' doesn't seem to make much of a difference. Take it out and s1.x is no longer accessible as would be expected. But s2 and s3 seem unaffected.