Is is safe to freeze an object (an array, say) in ruby, but modify it
from C extension code? Does ruby assume that a frozen object will never
change, or does it just prevent modification from the normal method API?
Will this change in future rubies?
Joel VanderWerf wrote:
Is is safe to freeze an object (an array, say) in ruby, but modify it
from C extension code?
This thread might help.
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/94429?94266-96840
daz
daz wrote:
Joel VanderWerf wrote:
Is is safe to freeze an object (an array, say) in ruby, but modify it
from C extension code?This thread might help.
http://blade.nagaokaut.ac.jp/cgi-bin/vframe.rb/ruby/ruby-talk/94429?94266-96840
Well, matz encourages (in [ruby-talk:94540]) extension writers to check
frozen status, but does not say he requires it.
I was just worried that in the future there might be some optimization
that assumed “obj.freeze” was a promise not to change the object.
In my case, I just want to ensure that the object is not modified by
user code, but only by my extension.