[Nitro] Simpler configuration method?

transfire at gmail.com transfire at gmail.com
Sat Feb 3 15:13:30 EST 2007

On Jan 25, 5:01 am, "George Moschovitis"
<george.moschovi... at gmail.com> wrote:
> Dear devs,
> I am thinking about replacing the current configuration/settings
> system used in Nitro and Og with a much simpler implementation
> based on global variables. Let me demonstrate with an example:
> instead of
> class Server
>   setting :root_dir, :default => 'public', :doc => 'The default dir'
> end
> dir = Server.root_dir
> use the following:
> $server_root_dir = 'public' # The default dir
> dir = $server_root_dir
> The main drawback of the current version is that you have to
> define the classes to be configured before executing any configuration
> code and/or require the glue/configuration.rb file. This prohibits
> the reusability and flexibility of the configuration files. Moreover,
> as the configuration system uses annotations there is a slight performance
> penalty that may be serious if a configuration variable is used
> in a tight loop.
> I understand that global variables are considered evil, but I think
> they are very suitable for configuration. I especially like the
> fact that global variables default to nil (==false) if they are not
> previously defined.
> I would like to hear some opinions on this.
> thanks in advance,


Did you decide on this? Dod you do any work on this? Did you try
making it an instatiable class?


More information about the Nitro-general mailing list