note 39672 added to language.operators.logical

From: Date: Fri, 06 Feb 2004 22:32:34 +0000
Subject: note 39672 added to language.operators.logical
Groups: php.notes 
Request: Send a blank email to php-notes+get-64744@lists.php.net to get a copy of this message
"Just Because You Can, Doesn't Mean You Should." I also feel that circumventing short-circuit evaluation and relying on side-effects in conditional expressions is exercising bad style. Writing code that documents itself using clear and straightforward constructs strikes me as a much better practice than using a convoluted and difficult-to-read expression and explaining it with comments (or worse yet, not documenting it at all!) Indeed, source code should be written for the programmer's eyes more so than the computer's. Utilizing the bitwise operators in a logical context could violates the expectations of the reader and may create confusion because bitwise operators imply bit-field operands. I also feel that assuming that short-circuit evaluation is best for logical constructs IS within the compiler's "rights", since when logical operators are used for their intended purpose, the assumptions that short-circuiting makes *ARE* logical, and do (once again, when used correctly) optimize evaluation of logical expressions. It is not my intention to directly flame or insult any individual, but only to discourage the use of poor style and to encourage new (and even some experienced) programmers to write clear and verbose code, and to think about the programmers, rather than the computers that might end up trying to decipher your creations. ---- Manual Page -- http://www.php.net/manual/en/language.operators.logical.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+39672 Delete -- http://master.php.net/manage/user-notes.php?action=delete+39672&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+39672&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#64744) next »