Re: [RFC] export TRUE and FALSE from someplace



* Bjarne Steinsbø <bosteins broadpark no> [2004-01-21 14:24]:
Zero is also false, that is true, but a true boolean expression
in perl returns undef or one, not zero or one.  (Sorry, I can't
help it.  Writing about boolean logic just makes it too easy to
play on words... :-)

Booleans produce an empty string, not undef, for false. That can
easily be produced without hardcoding FALSE by having it be
!TRUE.  As I've already said. :)

They are unnecessary (don't improve readability) in code like

 if ($boolean == TRUE) { ...  } else { ... };

This is just naivity on the part of the programmer.

and I would argue they don't really improve readability that
much in code like

 $widget->pack_start (FALSE, FALSE, 0);

I would say it is already a vast improvement over (1, 1, 0), even
though ...

If the booleans do have a more specific meaning, other names should be 
chosen (as Joe Smith demonstrated) with more semantic meaning:

 $box->pack_start ($widget, NO_EXPAND, NO_FILL, 0);
 $window->signal_connect (delete_event => sub { return STOP_EVENT_PROPAGATION });

... this is certainly very true.

-- 
Regards,
Aristotle
 
"If you can't laugh at yourself, you don't take life seriously enough."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]