On Nov 25, 1:53=A0pm, Yukihiro Matsumoto <m... / ruby-lang.org> wrote:
> Hi,
>
> In message "Re: [ruby-core:20096] Re: [Bug #796] dynamic constant assignm=
ent"
> =A0 =A0 on Wed, 26 Nov 2008 03:42:29 +0900, Jim Deville <jdevi...@microso=
ft.com> writes:
>
> |What about a conditional dynamic assignment. It would be nice to have an=
 idiom such as:
> |
> |CONST ||=3D "foo"
> |
> |I've wanted this in the initializer before, and I end up using a ternary=
 and Module#const_set
>
> Please understand constants are constants. =A0Adding such features might
> be useful for some cases, I admit, but it makes constants more and
> more like mere variables. =A0In my opinion, making constants mere
> variables do not buy you much in the long term.

Indeed. And yet, I'm not sure what the current middle ground approach
buys us either. You can still change them via remove_const and
const_set, so what's the difference? As far as I can tell, all that
accomplishes is extra hoop jumping by us programmers. It's not like
Ruby's execution is optimized knowing constants won't change.

                   trans.