Catch it? A constant was added at the same time that there was a local variable.
No, it was not added, and there was no local variable.
One object referenced by both a constant and a local variable is added, but neither the constant nor the local variable has been changed. You cannot change or change a variable or constant in Ruby (at least not as your question implies), the only thing you can change is objects.
, , .
- , . , , , . . , . . . , . , .
, : , , Python, Java, #, ++, C, Lisp, Smalltalk, JavaScript, PHP, Perl , , , final const , .
, , , .
Ruby freeze , . , , , , , , . , , , dup. , , , : dup , , . freeze , , :
ORIG = ['Hello']
CLONE = ORIG.dup.freeze
CLONE[0] << ', World!'
CLONE
. - (, : , , ) (, : , , ).
, , . Ruby: , , . , , .