so I resend it here. Does someone have any clues on this ?
Thanks,
david
Hi,
got some strange result in ruby1.8 (1.8.7.72-3) on jaunty (up to date).
Don’t know if I use correctly dup function but my duped hash is
modified even if i call the freeze method. Below the quick and dirty
test case showing that @c member of the class Global is modified
#!/usr/bin/ruby
class Testme
attr_accessor :value
def initialize(val)
@value=val
end
def Testme::bou(val)
$a[“b”].value=val
end
def to_str()
print @value,“\n”
end
end
class Global
def initialize
@c=nil
end
def go()
@c=$a.dup @c.freeze #print value before the changes
to_str()
end
def to_str()
print @c,“\n”
end
If you want a “deep freeze” then you’ll have to do it yourself.
Your test code looks rather more convoluted than it needs to be, so you
should be able to boil it down to a two or three line case which shows
you what’s happening.
However I suggest you close the Ubuntu ticket though as ‘invalid’