Hi,
In message "Re: Freeze not freezing"
on Thu, 5 Nov 2009 23:05:28 +0900, Ralph Shnelvar <ralphs / dos32.com> writes:
|a) Is my reasoning correct?
#freeze protect an object from modification. The reference is not the
target of freezing.
|b) Is there a way to do what I want? That is, freeze f or c[0] so that
|I get some sort of message/error/exception?
You can protect an array (or object) as a whole, since it is an
object, so that
c=[0,1]
c.freeze
c[0]=2 # => can't modify frozen array (RuntimeError)
but you cannot freeze any variables.
|c) Do my examples violate POLS?
No. Unlike C++, variables and references are not object in any sense
in Ruby. From my viewpoint, C++ violates POLS. ;-)
matz.