From: "Iñaki Baz Castillo" Date: 2011-05-01T04:58:38+09:00 Subject: Re: Why defining a constant in a method is not allowed but using self.class.const_set is allowed? 2011/4/30 Robert Klemme : > On 30.04.2011 21:25, Iñaki Baz Castillo wrote: >> >> Hi, assinging a value to a constant within a method is not allowed >> (SyntaxError:: dynamic constant assignment) but I can use >> self.class.const_set within a method. Which is the difference? > > You described the difference pretty accurately.  It is quite common for Ruby > to forbid doing bad things directly while still leaving a way to do it > nevertheless (just think of private methods and #send). Ok. Then one question more: why is not possible to reassing a value to a constant (even using self.class.const_set)? Is there internal issue with it? I get a warning doing it (I suppose it depends on $safe value), but what is the real problem with it? Thanks a lot. -- Iñaki Baz Castillo