ts <decoux / moulon.inra.fr> writes:

> >> $/.freeze	  # prevent changing from defaults
> 
> D> That freezes the object referenced by the $/ variable. Variables
> 
>  The object is frozen
> 
>     rb_rs = rb_default_rs = rb_str_new2("\n"); rb_output_rs = Qnil;
>     rb_global_variable(&rb_default_rs);
>     OBJ_FREEZE(rb_default_rs);	/* avoid modifying RS_default */
>     rb_define_hooked_variable("$/", &rb_rs, 0, rb_str_setter);

Yes - the default is frozen.
> 
> D> themselves cannot be frozen.
> 
>  This can be tested in rb_str_setter, no ?

But what would you check? Would you disallow the assignment if the
object currently referenced by a $ global is frozen? That would be
difficult for "$," which by default is nil (as nil can't be frozen).

I must not be understanding.


Dave