Difference in module_eval taking block vs. taking string (1.8 bug?)

The following code:

class Klass
end
p Klass.instance_methods(false)
Klass.module_eval do
def hello
puts 'hello’
end
end
p Klass.instance_methods(false)
Klass.module_eval(“def hello2() puts ‘hello2’; end”)
p Klass.instance_methods(false)

produces this output in 1.8.0pre3:

[]
[]
[“hello2”]

but in 1.6.8 it produces:

[]
[“hello”]
[“hello2”, “hello”]

Is this a bug in 1.8 or a feature?

Hi,

···

In message “Difference in module_eval taking block vs. taking string (1.8 bug?)” on 03/07/18, Jim Cain list@jimcain.us writes:

Is this a bug in 1.8 or a feature?

It was a bug fixed July 2 2003.

Wed Jul 2 13:22:39 2003 Yukihiro Matsumoto matz@ruby-lang.org

* eval.c (rb_yield_0): override visibility mode for module_eval
  etc. (ruby-bugs-ja PR#505)


						matz.

Yukihiro Matsumoto wrote:

Hi,

Is this a bug in 1.8 or a feature?

It was a bug fixed July 2 2003.

  • eval.c (rb_yield_0): override visibility mode for module_eval
    etc. (ruby-bugs-ja PR#505)

      				matz.
    

Thanks. I checked out the latest from CVS, and it works.

···

In message “Difference in module_eval taking block vs. taking string (1.8 bug?)” > on 03/07/18, Jim Cain list@jimcain.us writes:
Wed Jul 2 13:22:39 2003 Yukihiro Matsumoto matz@ruby-lang.org