Re: "0", true or false? (was: PERL6STORM #0052)

2000-10-02 Thread Nathan Wiger

"David L. Nicol" wrote:
> 
> Bart Lateur wrote:
> 
> > Bitwise and, or and xor do distinguish strings from numbers, and return
> > entirely different kinds of results. Why can't anything else?
> 
> Absolutely.  There is such a thing as Too Much Convenience.  I think
> BOOL as a context or an accessor method should be separate from STRING and
> NUMBER so that if you know, you can suggest which behavior you want out
> of a particular scalar variable, or stick with the misguidable default.

See RFC 159 - BOOLEAN, STRING, and NUMBER are the three main methods.

-Nate



Re: "0", true or false? (was: PERL6STORM #0052)

2000-10-02 Thread David L. Nicol

Bart Lateur wrote:

> Bitwise and, or and xor do distinguish strings from numbers, and return
> entirely different kinds of results. Why can't anything else?

Absolutely.  There is such a thing as Too Much Convenience.  I think
BOOL as a context or an accessor method should be separate from STRING and
NUMBER so that if you know, you can suggest which behavior you want out
of a particular scalar variable, or stick with the misguidable default.



-- 
  David Nicol 816.235.1187 [EMAIL PROTECTED]
"After jotting these points down, we felt better."



"0", true or false? (was: PERL6STORM #0052)

2000-09-22 Thread Bart Lateur

On Thu, 21 Sep 2000 05:21:27 -0600, Tom Christiansen wrote:

>=item perl6storm #0052
>
>Make "0" (more?) true so that people don't get surprised.
>
>or
>
>Make "0.00" (more?) false so that people don't get surprised.

Yup. This tripped me up, years ago, followed by a heated discussion on
comp.lang.perl.misc. At the time, the docs even said that only undef, 0
and "" are false. That makes sense. "0" is, to be pedant, not one of
those 3. It is just a nonempty string with numerical value zero. So is
"0E0", and "0.0".

IMO, the only false string should be the empty string. If you want to
test it as a number, then convert it to a number, for example by adding
zero to it!

Bitwise and, or and xor do distinguish strings from numbers, and return
entirely different kinds of results. Why can't anything else?

-- 
Bart.