It sounds like a good fit for a singleton class. You can freeze it after
state setup is done.

Gennady.

----- Original Message ----- 
From: "Jim Freeze" <jim / freeze.org>
To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
Sent: Thursday, May 08, 2003 3:31 PM
Subject: Re: Can a global be a constant?


> On Friday,  9 May 2003 at  7:07:36 +0900, Hal E. Fulton wrote:
> > ----- Original Message ----- 
> > From: "Jim Freeze" <jim / freeze.org>
> > To: "ruby-talk ML" <ruby-talk / ruby-lang.org>
> > Sent: Thursday, May 08, 2003 4:45 PM
> > Subject: Can a global be a constant?
> >
> >
> > The first character is less like a prefix
> > than like a part of the name. If it starts
> > with a $, it doesn't start with a capital
> > letter.
> >
> > OTOH, constants have a big scope anyway.
> > Did you want to keep the scope across
> > files or something?
> >
>
> Actually, what I am thinking about is how
> to declare application state.
> For example, if an app is run with a --verbose
> or a --debug option, I want every object that
> I instantiate to respond appropriately, including
> threads and forks.
>
> In addition, I think it is in bad taste to use
> global variables. So I have been playing around
> with constants and such. (I was comparing scope
> between globals and constants when I discovered
> this.)
>
> So, I either have to relinquish my hesitation to use
> global variables, or find a suitable alternative.
>
> Do you have any suggestions?
>
> -- 
> Jim Freeze
> ----------
> Left to themselves, things tend to go from bad to worse.
>
>