Re: Primitive Boolean type?

2002-11-03 Thread Michael Lazzaro
Larry wrote: $z = 0 but true; I'm not even particularly upset by this: my bool $x = $z;# $x == 1 Yep, that's all I mean. I just want things like: my bool $lit = ($light eq on); if $lit { ... } to work such that (1) 'bool' always stores the truth of the

Re: Primitive Boolean type?

2002-11-03 Thread Smylers
Michael Lazzaro wrote: Agreed: the value of comparing a boolean with anything else is not particularly sensible in *any* language. It isn't particularly unsensible in PHP. PHP only has one equality operator. If its operands are of different types then it casts one operand to match the other,

Re: Primitive Boolean type?

2002-11-01 Thread Michael Lazzaro
On Friday, November 1, 2002, at 08:02 AM, Mark J. Reed wrote: When someone asks what's the boolean type in Perl? I'd rather answer bit than Perl doesn't have one, if for no other reason than the latter answer will completely freak them out. :-) Why? Plenty of languages get along just fine

RE: Primitive Boolean type?

2002-11-01 Thread David Whipp
David Wheeler [mailto:david;wheeler.net] wrote: The problem with this is that you have explicitly introduced true and false into the language, and have therefore destroyed the utility of context: my boolean $bool = 0; # False. my $foo = ''; # False context. if ($foo eq

Re: Primitive Boolean type?

2002-11-01 Thread Michael Lazzaro
On Friday, November 1, 2002, at 01:38 PM, David Whipp wrote: Presumably, there exist rules for implicit casting when comparing objects of different types. If we have a rule My initial assumption is that nothing would change. Namely, == compares numerically, eq compares strings, and '?'

Re: eq Vs == Vs ~~ ( was Re: Primitive Boolean type?)

2002-11-01 Thread Sean O'Rourke
See http://archive.develooper.com/perl6-internals;perl.org/msg11308.html for a closely-related discussion. /s On Fri, 1 Nov 2002, David Whipp wrote: In Perl6, everything is an object. So almost everything is neither a number nor a string. It probably doesn't make sense to cast things to

Re: Primitive Boolean type?

2002-10-31 Thread David Wheeler
On Thursday, October 31, 2002, at 02:43 PM, Michael Lazzaro wrote: Q: Can bits/bools be undefined? Perl conventions would indicate yes. IIRC, native data types, which are all lowercase (e.g., int, bit, long, etc.) cannot be undef. However, their class equivalents (e.g., Int, Bit, Long,

Re: Primitive Boolean type?

2002-10-31 Thread Larry Wall
On Thu, 31 Oct 2002, Michael Lazzaro wrote: : While writing documentation: a trivial question on the boolean type, : Cbit: Please don't think of Cbit as a boolean type. There is no boolean type in Perl, only a boolean context. Or looking at it from the other direction, *every* type is a