safe to modify frozen object from C?

J

Joel VanderWerf

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?
 
J

Joel VanderWerf

daz said:

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top