[Nitro] Simpler configuration method?

Jonathan Buch john at oxyliquit.de
Sat Feb 3 16:11:15 EST 2007


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

George and I (and some others) discussed on that in #nitro for a
while.  I managed to bring George away from the $global idea,
his current take on it is (I hope I get that right):

class Nitro::Conf < Hash

class Nitro::Compiler
   Conf[:Compiler_mixin_get_parameters] = true

Which I found at least better than using 400 $globals just for the
Nitro internal configuration...

But, the namespace issue still stays.  It's possible (since this is
a single hash) to override stuff accidentally.  It also looks uglier

class Nitro::Compiler
   setting :mixin_get_parameters, :default => true, :doc => "/meth?a=foo like /meth/foo"

Where each Klass gets its own namespace for settings.  Implementation
is slightly more complicated of course, also there are some issues with
'configuring not yet defined classes' (which is possible though, just
not as visually pleasing).

The current system also has the advantage of being able to view settings
nicely 'threaded' at run-time, even with documentation.


Feel the love

More information about the Nitro-general mailing list