Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Difference in module_eval taking block vs. taking string (1.8 bug?)

Reply
Thread Tools

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

 
 
Jim Cain
Guest
Posts: n/a
 
      07-18-2003
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?


 
Reply With Quote
 
 
 
 
Yukihiro Matsumoto
Guest
Posts: n/a
 
      07-18-2003
Hi,

In message "Difference in module_eval taking block vs. taking string (1.8 bug?)"
on 03/07/18, Jim Cain <(E-Mail Removed)> 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 <(E-Mail Removed)>

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


matz.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What's difference between class_eval and module_eval ? Kyung won Cheon Ruby 1 08-01-2008 09:08 AM
Fo:Block can you check to see if a block contains any text by using the block id? morrell XML 1 10-10-2006 07:18 PM
module_eval, scope, __FILE__ and __LINE__ Florian G. Pflug Ruby 0 02-17-2004 05:51 PM
overload method in module_eval, how? Simon Strandgaard Ruby 12 11-10-2003 04:42 PM



Advertisments