On 06 Dec 2004, at 14:12, itsme213 wrote:

>> You cannot freeze variables, just objects.
>>
>> a = "foo"
>> a.freeze
>> a = "bar"
>
> I respecfully but heartily disagree. Ruby freezes objects by freezing 
> their
> instance variables. The latter is the fundamental operation.

variable.c disagrees with you:

VALUE
rb_ivar_set(obj, id, val)
     VALUE obj;
     ID id;
     VALUE val;
{
     if (!OBJ_TAINTED(obj) && rb_safe_level() >= 4)
     rb_raise(rb_eSecurityError, "Insecure: can't modify instance 
variable");
     if (OBJ_FROZEN(obj)) rb_error_frozen("object");

> a = "foo" # makes the variable a refer to the object "foo"
>
> a.freeze # makes the instance variables of the object "foo" frozen.
>
> Try this:
>
> @a = "foo"
> self.freeze
> @a = "bar"

No, self is frozen, not @a.  Your example is no different than the one 
using Effable.

@a = "foo" # self.instance_variable_set "@a", "foo"
self.freeze
@b = "bar" # self.instance_variable_set "@b", "bar", raises because 
self is frozen.