On 23.10.2007, at 21:24, Stephen Deasey wrote:
>
> But one of the things we want to support is introspection, right?

Right.

>
>
>   foreach section [ns_getconfig] {
>       foreach {k v} [ns_getconfig $section] {
>           ...
>       }
>   }
>
>
> The only way to make it work atm is to pre-declare all config values:
>
>
>   # mylib.tcl
>
>   ns_setconfig section enabled true
>   ...
>
>   proc foo {} {
>       if {[ns_getconfig section enabled]} {
>           ...
>       }
>   }
>   ...
>
>
> Pre-declaring is a new restriction. Is this the plan?

Well, I went ahead in making it ns_config compatible
although this may NOT really always be clear.

If you do not set default values, then module A might
have different defaults then module B, which is right
and wrong, depending on the position...
If you however set them in module A, might that have
side-effects in module B ?

Perhaps the clearest is to have both, as you say below...

>
> I could also imagine having a hybrid system, where you *could*
> pre-declare, but you could also have ad-hoc calls. Both have their
> benefits:
>
> - Config which is only referenced once, and rarely if ever needs to be
> changed, is ideally handled with inline calls. Everything is in one
> place.
>
> - Config which cannot be guessed, e.g. a host name, or which is
> accessed from multiple pieces of code, would benefit from a
> declaration. This would allow the default to be written once and make
> options for configuring code more obvious.
>
>
> A system of pre-declaring might have benefits for C-code especially.
>
>
> Or..?
>


So we'd change (back) the config to set default values when first
required ?



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to