Re: Primitive Boolean type?

2002-11-03 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Date: 3 Nov 2002 14:58:52 - > From: Smylers <[EMAIL PROTECTED]> > X-Posted-By: 193.237.84.140 > > Michael Lazzaro wrote: > > > Agreed: the value of comparing a boolean with anything else is not > > particularly sensible in *any* langua

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

Re: Primitive Boolean type?

2002-11-02 Thread Damian Conway
Larry wrote: I am overstating the case when I say there's no boolean type in Perl. What I really mean is that there is no such thing as a single true "true" value. Curiously, junctions do get us quite close to the possibility of canonical true and false values: my $false is constant = any(0

Re: Primitive Boolean type?

2002-11-02 Thread Larry Wall
On Sat, Nov 02, 2002 at 07:07:43AM -0800, Austin Hastings wrote: > I don't recall the terminology, but I believe that "0 but true" is a > value with a "fillintheblank" (attribute?). What happens when you stick > "0 but true" into a bit? $z = 0 but true; my bit $x = $z; # $x ==

Re: Primitive Boolean type?

2002-11-02 Thread Austin Hastings
--- Michael Lazzaro <[EMAIL PROTECTED]> wrote: > > 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 complete

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

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

2002-11-01 Thread David Whipp
Michael Lazzaro [mailto:mlazzaro@;cognitivity.com] wrote > 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.

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 '?' enfor

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

Re: Primitive Boolean type?

2002-11-01 Thread David Wheeler
On Friday, November 1, 2002, at 12:24 PM, Michael Lazzaro wrote: So what is the "official" way to efficiently store the result of a boolean expression, for example? If not as a "bit", then what? If anything, I would suggest a primitive type, "bool", that has no promoted type "Bool". It can

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 f

Re: Primitive Boolean type?

2002-11-01 Thread Mark J. Reed
On Thursday, October 31, 2002, at 10:36 PM, Michael Lazzaro 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 a

Re: Primitive Boolean type?

2002-11-01 Thread David Wheeler
On Thursday, October 31, 2002, at 10:36 PM, Michael Lazzaro wrote: So while I understand the philosophical/semantic reasons for the absence of a true boolean type, I wonder how easy it will be to describe the principle to newcomers, and if it's worth it. When someone asks "what's the boolean

Re: Primitive Boolean type?

2002-10-31 Thread Luke Palmer
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm > Date: Thu, 31 Oct 2002 22:36:58 -0800 > From: Michael Lazzaro <[EMAIL PROTECTED]> > X-Accept-Language: en,pdf > Cc: [EMAIL PROTECTED] > X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/ > > Larry Wall wrote: > > Please don't think

Re: Primitive Boolean type?

2002-10-31 Thread Michael Lazzaro
Larry Wall wrote: > Please don't think of C 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 boolean type. Er... dang. While I certainly agree with the concept in principle, I'm having a hard time stick

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, : C: Please don't think of C 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 boolean type.

Re: Primitive Boolean type?

2002-10-31 Thread Larry Wall
On Thu, 31 Oct 2002, David Wheeler wrote: : 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.

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, etc)

Primitive Boolean type?

2002-10-31 Thread Michael Lazzaro
While writing documentation: a trivial question on the boolean type, C: my bit $light_switch; Q: Can bits/bools be undefined? Perl conventions would indicate yes. Does that mean that an array of bits: my bit @bitfield; takes up, at minimum, two bits per, um, bit? Sorry if this ques