[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Strange constant resolution behaviour after Class#dup

Martin Thiede

2/14/2009 9:07:00 PM

Hello,

the following code produces different results when executed with Ruby
1.8.6 on Windows and Fedora 9:

class A
def call_b_with_dup
B.dup.new.b
end
def call_b_without_dup
B.new.b
end
end

class B
def b
XXX
end
end

begin
A.new.call_b_with_dup
rescue Exception => e
puts e
end

begin
A.new.call_b_without_dup
rescue Exception => e
puts e
end

*** Results ***

Windows:

uninitialized constant B::XXX
uninitialized constant B::XXX

Fedora 9:

uninitialized constant A::XXX
uninitialized constant B::XXX


Whats the correct behaviour? I suppose the first one and the second is a
bug.
If so, is this bug already known?

Thanks,

Martin
--
Posted via http://www.ruby-....