Re: Storing object references in hashes



"Paul Lalli" <mritty@xxxxxxxxx> wrote in
news:1138715672.390211.173060@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:

> Bryan Balfour wrote:
....

>> TRUE/FALSE v's 1/0. Using TRUE/FALSE means more to me than 1/0 so,
>> until it's demonstarted to me that it's poor programming, I'll
>> continue. I've used this technique for years, together with ON/OFF
>> etc, and I'm too old to change now without a good reason.
>
> My only issue with it is that it requires more typing (both by way of
> typing TRUE instead of 1, and the declarations of the constants in
> every package), for seemingly little benefit.

"False" in Perl is not just zero. In particular, the empty string and
empty list are among the possible false values that can be returned.
"True" is not just 1, "0.0" is true as well.

While one may find it easy construct the correct returns/comparisons in
one's own code Perl itself, and modules do use the full range of values.

#define TRUE 1
#define FALSE 0

was never a good idea in C or C++, and it is not in Perl.

Sinan
--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(reverse each component and remove .invalid for email address)

comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

.



Relevant Pages

  • Re: use of DBI; I am getting multiple error messages mixed in with the correct output.
    ... Objects in Perl are not always the right solution. ... implies that what I read in Wall et al.'s book is either wrong ... The second is that he maintains that the empty string is the ... uninitialized variables on the other? ...
    (comp.lang.perl.misc)
  • Re: CPAN install failure - help?
    ... Sinan Unur wrote: ... Unless you are using cygwin, you very likely do not have the proper tools to compile Perl modules from scratch. ... Interestingly enough, I've also got Fedora Core 3 on another machine, and on that one, once I su'ed to root, the install worked the first time. ...
    (comp.lang.perl.misc)
  • Re: why the perl documents is hard to understand?
    ... Sinan Unur wrote: ... > you expect all Perl programmers the world over to delete all Perl ... What is it about the 'Generals' in this newsgroup. ... the comp.lang.perl.misc regulars, have something to teach me - yet I ...
    (comp.lang.perl.misc)
  • Re: Space (s) count problem
    ... sub use_index { ... This is perl, v5.8.7 built for MSWin32-x86-multi-thread ... Binary build 813 provided by ActiveState ... Sinan Unur ...
    (comp.lang.perl.misc)
  • Re: Use of uninitialized value in substitution (s///)
    ... >> Hello Anno, ... > Perl converts the undefined value to an empty string, ... > may not be what the programmer intended, hence the warning. ...
    (comp.lang.perl.misc)