From: Phillip Gawlowski Date: 2011-05-01T09:13:02+09:00 Subject: Re: Why defining a constant in a method is not allowed but using self.class.const_set is allowed? On Sun, May 1, 2011 at 1:48 AM, Iņaki Baz Castillo wrote: > > Yes, I understand that redeining a constant is not "good" in any > language, just wondering why Ruby, being so flexible, also behaves > like others. It's called a "constant". What would you expect it to be? Ever changing like like the wind, or steady and everlasting like the mountains?* Ruby gives you the mountain--and the tools to change the mountain into a sculpture. It's the Principle Of Least Surprise (To Matz) hard at work. :) > It seems not very suitable in my application. Basically I get a conf > file and want to store configuration data in constants (for faster > lockup). But I also need to change those values in realtime. Well, before making constants mutable, I'd see if they actually are a worthwhile target of optimization (and the possible breakage this introduces). Maybe a configuration Hash is an acceptable compromise between lookup speed and mutability? * I know, mountains erode, and winds actually have patterns to them, but allow me to be a bit flowery for once. :) -- Phillip Gawlowski Though the folk I have met, (Ah, how soon!) they forget When I've moved on to some other place, There may be one or two, When I've played and passed through, Who'll remember my song or my face.