From: Robert Dober Date: 2008-05-22T21:36:14+09:00 Subject: Re: Prevent ruby constant variables from changing? On Thu, May 22, 2008 at 1:38 PM, Florian Gilcher wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > On May 22, 2008, at 1:01 PM, Dave Bass wrote: > >> George Wang wrote: >>> >>> However, the constant variable can still be >>> reassigned even though a warning is issued. >> >> Am I the only person who thinks that constants should be unchangeable? >> >> Being new to Ruby, it seems weird to me that constants aren't actually >> constant. I'm sure there must be some arcane reason for it, but surely >> most people want their constants to remain constant! That's how it works >> in most languages. >> >> Freezing would seem like a good idea but I haven't actually tried it. >> Yet. >> -- >> Posted via http://www.ruby-forum.com/. >> > > If you noticed, class names are constants. Not necessarily. c = Class::new { def ... } >As you can change classes at > runtime, constants must be changable. Not at all, you can always change the object a constant points to, unless it is frozen. Robert -- http://ruby-smalltalk.blogspot.com/ --- Whereof one cannot speak, thereof one must be silent. Ludwig Wittgenstein