Is there a way to freeze instance variables in Ruby in order to make
them single assignment? I’m just wondering if there’s a way to simulate
Erlang in this regard as a way to avoid side effects.
I don’t want to simply not define (or undefine) a setter method because
you could still get at the instance variable via instance_variable_set.
Redefining instance_variable_set won’t work either, because that method
is apparently not called when performing direct assignment of instance
variables. I tried calling the freeze method on the instance variables
directly but that didn’t seem to work either.
Is it possible?