Re: Is there a True Boolean type in Perl?
On 10/15/07, Michael Barto [EMAIL PROTECTED] wrote: I think in the more newer languages, they have implemented true booleans. Perl is kind of old school. Pascal defines them as a grandfather of languages. Therefore as one migrates the languages to a higher levels (e.g. Perl[n]), they all will end up with a boolean data type. Therefore, I think the $true and $false is a more consistent method in a multiple languages environments (particularly doing web things [Java and Javascript] for a consistent set of rules across the board. Thanks for your input. snip Perl 6 will have true boolean values: True and False. See S02 for more information. http://dev.perl.org/perl6/doc/design/syn/S02.html
Re: Is there a True Boolean type in Perl?
On 10/15/07, Doug McNutt [EMAIL PROTECTED] wrote: At 18:20 -0700 10/15/07, Michael Barto wrote: I think in the more newer languages, they have implemented true booleans. Perl is kind of old school. use constant TRUE = 1; use constant FALSE = 0; Is a complete solution in perl 5. There was once a reason back in the time of grandfathered languages for booleans which actually used only one bit of a precious word of memory. That would be a true boolean. I'll bet those new school languages use a native word, 16 , 32, or perhaps 64 bits while arguing that it's faster and better that way. It is actually worse than you suspect. Most of them implement boolean types as objects (which take up more than one word). On the plus side they tend to be singleton objects, but the reference still takes up (at least) a word.
Re: Leopard Perl version...
On Sun, Oct 14, 2007 at 11:32:09AM -0700, Edward Moy wrote: So software updates are restricted to keep the size down. Because most users do not use the command-line or develop software, updates to command-line programs never make the cut (developer software has it own update channel). This makes perfect sense. Is it possible to add this seperate channel to Software Update? -- header FROM_DAVID_CANTRELLFrom =~ /david.cantrell/i describe FROM_DAVID_CANTRELLMessage is from David Cantrell scoreFROM_DAVID_CANTRELL15.72 # This figure from experimentation
Re: Leopard Perl version...
On 平成 19/10/16, at 19:56, David Cantrell wrote: On Sun, Oct 14, 2007 at 11:32:09AM -0700, Edward Moy wrote: So software updates are restricted to keep the size down. Because most users do not use the command-line or develop software, updates to command-line programs never make the cut (developer software has it own update channel). This makes perfect sense. Is it possible to add this seperate channel to Software Update? My understanding is that it is what you might call a manual channel. (Which is the way I prefer it even if it sometimes seems inconvenient.) Joel Rees (waiting for a 3+GHz ARM processor to come out, to test Steve's willingness to switch again.)
Re: Is there a True Boolean type in Perl?
On Mon, Oct 15, 2007 at 01:27:26PM -0700, Michael Barto wrote: As both Java and Javascript both have a 'true' and 'false' or Boolean data type, is there any interest in evolution of Perl to have a true Boolean. Or what is the preferred method to do this in Perl. The place to discuss this is the perl5-porters mailing list, not an obscure platform-specific mailing list. And the answer is no. Because we already have a real Boolean. We have boolean *context*. An operator like ?: forces its first operand to be evaluated in boolean context: $value ? 'true' : 'false' That first operand can, of course, be a complex expression, the end result of which is evaluated in boolean context: cheezburger-{$cutecat}-() ? print LOL! : print OH NOES! We also don't have int or float or a numeric type (the internals do, but Perl the language doesn't) - we have numeric context. Consider this: $ perl -e 'print foo\n if 2abc == 2def' The == operator forces both its operands to be evaulated in numeric context before comparing them. As numbers, 2abc and 2def are both just plain ol' 2, so the == returns true and we print. If we change it to this: $ perl -e 'print foo\n if 2abc eq 2def' then the eq operator evaluates its operands in string context, where 2abc and 2def most definitely aren't the same. The C programmers want me to use 0's and 1's. Seems reasonable. Those do evaluate to false and true in perl. Perl's comparison operators return 1 for true and the empty string for false. In numeric context that's the same as returning 1 and 0 because: '' == 0 -- David Cantrell | Hero of the Information Age When a man is tired of London, he is tired of life -- Samuel Johnson
Re: Leopard Perl version...
On Oct 16, 2007, at 3:56 AM, David Cantrell wrote: On Sun, Oct 14, 2007 at 11:32:09AM -0700, Edward Moy wrote: So software updates are restricted to keep the size down. Because most users do not use the command-line or develop software, updates to command-line programs never make the cut (developer software has it own update channel). This makes perfect sense. Is it possible to add this seperate channel to Software Update? -- header FROM_DAVID_CANTRELLFrom =~ /david.cantrell/i describe FROM_DAVID_CANTRELLMessage is from David Cantrell scoreFROM_DAVID_CANTRELL15.72 # This figure from experimentation Unlikely. A channel is more than what you see in Software Update. It includes lots of people to create the update, test it, package it up, etc. Ed
Re: Is there a True Boolean type in Perl?
Chas == Chas Owens [EMAIL PROTECTED] writes: Chas On 10/15/07, Michael Barto [EMAIL PROTECTED] wrote: As both Java and Javascript both have a 'true' and 'false' or Boolean data type, is there any interest in evolution of Perl to have a true Boolean. Or what is the preferred method to do this in Perl. The C programmers want me to use 0's and 1's. Chas snip Chas Perl 5 does not have a boolean type. Perl considers the following Chas things as false: any number that is equivalent to 0 (0.0, 0e0, etc.), Chas the string '0', the empty string, undef, or an empty list ( i.e. ()). The empty list doesn't belong in that list. Boolean forces scalar context, and the scalar version of () is simply undef, which you've already listed. Unless you also want to add (undef) or (0) or () to your list as well, which are just as false, and for the same reason. :) Yes, I know the third edition of the camel added this, but they were wrong. Please don't propogate the mistake. No edition of the camel that I was in charge of got this wrong. :) -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 [EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/ Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!