From: Olivier Renaud Date: 2007-03-16T00:46:49+09:00 Subject: Re: freeze string fails to freeze ??? Le jeudi 15 mars 2007 16:35, jwaala.amplify@gmail.com a �crit�: > >> a='asdf' > > => "asdf" > > >> a.freeze > > => "asdf" > > >> a='qwer' > > => "qwer" > > should'nt that throw and exception ??? No, because calling the freeze method prevents from modifying the object, it doesn't prevent from modifying the variable. Remember that a variable is just a way to give a name to an object, but it is not tied to this object forever. So, your code doesn't raise an exception, but this one does : irb(main):001:0> a="abc" => "abc" irb(main):002:0> a.freeze => "abc" irb(main):003:0> a << 'd' TypeError: can't modify frozen string from (irb):3:in `<<' from (irb):3 What you are looking for is closer of a constant, actually : irb(main):004:0> A="abc" => "abc" irb(main):005:0> A="def" (irb):5: warning: already initialized constant A -- Olivier Renaud