Charlie wrote:
> I'm new to Ruby programming and I saw this article which concerns me:
> 
> http://www.bitwisemag.com/copy/features/opinion/ruby/ruby_debate.html
> 
> Don't get me wrong, I love Ruby. But, the idea that a constant is not a 
> constant is worrying isn't it? Or have I missed something? Please 
> comment.
> 
> X = 10
> Y = "hello world"
> Z = "hello world"
> 
> X = 20
> Y = "byebye" << "abc"
> myvar = Z << "xyz"
> 
> puts(X)
> 20
> puts(Y)
> byebyeabc
> puts(Z)
> hello worldxyz
> myvar
> "hello worldxyz"

It's constant in that you can't reassign a different instance to the 
same name (try setting X = 10 after you've set it to 20 and Ruby will 
gripe).  The instances themselves may still be mutable (see 
Object#freeze if you want to change that).

-- 
Posted via http://www.ruby-forum.com/.