On Nov 29, 2007 6:45 AM, Vasiljevic Zoran <[EMAIL PROTECTED]> wrote:
>
> On Nov 29, 2007, at 7:32 AM, Stephen Deasey wrote:
>
> >
> > Are you saying that "false" is not false and "true" is not true?
>
> I'm saying that false IS zero and 1 IS true (better, non-zero is true).


OK. But why are you saying that?

The Tcl man pages define explicitly what the valid values for boolean
are, and in what context booleans are expected. Can you point to the
part which supports your argument?


> But this can bring us to the question:
>
>    set value [ns_config -bool jummy juice false]
>    if {$value == "true"} {
>       # ...
>    }
>
> and all sorts of other weird things. I know I know...


This is a false dilemma.

A string equality expression is not the only substitute for an integer
comparison expression.

if {$boolilicious} {   ;# <--- boolean expression
    puts "truthy"
}


> This all ISN'T very clear because Tcl's C-heritage and
> LACK of proper boolean type (actually lack of ANY types).


Tcl has a boolean type:

  http://www.tcl.tk/man/tcl8.5/TclLib/BoolObj.htm

It's string rep when false is 0, false, no, f and so on.


> So, we cannot teach Tcl types, we can only make some
> approximations. The (ns_config )code was simply too strict
> at that place


It was returning a boolean value, guaranteed. It used Tcl_GetBoolean
to parse the value from the config file, and Tcl_GetBooleanFromObj to
check the default value. If both of those calls return TCL_OK, then
whatever comes out the other side is a valid boolean value.

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to