[M3devel] BOOLEAN (Was: CVS Update: cm3)

Henning Thielemann lemming at henning-thielemann.de
Tue Jan 8 12:29:30 CET 2008


On Tue, 8 Jan 2008, Olaf Wagner wrote:

> Quoting Jay <jayk123 at hotmail.com>:
>
> > Style tangent: Have people heard the advise that boolean parameters
> > are bad, because at the callsite esp. they don't give much meaning?
> > What is TRUE? What is FALSE? Enums or named parameters are clearer.
>
> I tend to agree, but this might get religious ;-)

In Modula-3 you can explicitly write
   f (switch := TRUE);
  Problem is of course, that you only can but you need not.


Another advise I like to give about BOOLEANs is, that one should use
positive flag names, e.g. not
  skipIntro := FALSE;
 but
  showIntro := TRUE;

 not
  disableGUI := TRUE;
 but
  enableGUI := FALSE;




More information about the M3devel mailing list