On 10/24/07, Vasiljevic Zoran <[EMAIL PROTECTED]> wrote:
>
> On 23.10.2007, at 23:52, Vasiljevic Zoran wrote:
>
> > Now that we "solved" that one....
>
> So, it is done. I will shortly check-in the changes.
> But before I do, a question: how "seriously" should
> I take those tests:
>
> test cfg-4.3 {type check: bool != int} -body {
>      ns_getconfig -bool section cfg-4.3 yes
>      ns_getconfig -int section cfg-4.3 42
> } -returnCodes error -result {configuration parameter is not an integer}
>
> test cfg-4.4 {global type check: bool != int} -body {
>      ns_job wait cfgtest [ns_job queue cfgtest {
>          ns_getconfig -bool section cfg-4.4 yes
>      }]
>      ns_getconfig -int section cfg-4.4 42
> } -returnCodes error -result {configuration parameter is not an integer}
>
>
> If this should be true, then something like this should also fail:
>
>    ns_getconfig -bool foo bar 1
>    ns_getconfig -int foo bar
>
> Or not?


Should add that test.


> I mean, we are not Java. Tcl is still C-like:
>
>    set true 42
>    if {$true} {puts yesitis}
>
> Tcl will not jump in your face telling you that
> "true is not a boolean", or?


This works:

  if {[ns_getconfig -int section key 42]} {
      ...
  }

ns_getconfig both uses and declares. It declares so that an admin can
set the correct value. Some code may only need to check whether a
buffer size is greater than zero (is it true?), but that doesn't make
it a boolean config option. A buffer size of 'no' doesn't make any
sense.

-------------------------------------------------------------------------
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