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-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Strange constant resolution behaviour after Class#dup
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password