Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!brl-adm!brl-smoke!smoke!gwyn@BRL.ARPA From: gwyn@BRL.ARPA (VLD/VMB) Newsgroups: net.lang.c Subject: Re: Boolean Operators Slighted in C Message-ID: <825@brl-smoke.ARPA> Date: Tue, 13-May-86 22:15:18 EDT Article-I.D.: brl-smok.825 Posted: Tue May 13 22:15:18 1986 Date-Received: Sun, 25-May-86 06:39:49 EDT Sender: news@brl-smoke.ARPA Lines: 57 Index to participants: >>> Steven Brian McKechnie Sargent >> Doug Gwyn > Jim Cottrell >>> New operators like "< =", in addition to being hard to spell and >>> understand, >>> facilitate usages that just aren't that common. I hardly ever want to >>> say x = (x < y), and I don't mind typing the extra characters. I'm not >>> interested in paying compiler vendors money for supporting this >>> (or any other dubious misfeature pounded into the language for >>> "completeness'sake.") >> >> Here is an example where proper use of Boolean data would be violated. >> A statement like >> x = x < y; >> should NEVER be used, since it assigns a Boolean result to an >> arithmetic variable. This means that a "< =" operator is not >> a good idea. > > Wrong you are, Doug. You have been thinking in this Boolean paradigm > for so long that you are missing another Good thing. Implication! > Given that P and Q are `Boolean' variables (0 or 1), the Logical > Implication is described by the operator `<='. Thus, the statement > `x = p <= q;' sets the `boolean' value x to a `boolean' expression. > Since there are no such things as booleans :-), x, p, & q are integers. > It's all a matter of interpretation. APL has no `boolean exclusive or' > operator because the operator `!=' does the same thing (when given > only zero's or one's). There are sixteen different boolean functions > with two inputs and one output. They all fit nicely into C operators: > [table omitted] Even Boole knew that Boolean operations can be performed by appropriate arithmetic on {0,1} operands; that is irrelevant. The original example, x "< =" y;, interpreted as you suggest, would mean `set x to "x is not implied by y"', if and only if x and y were Boolean in the first place. Not only is this of negligible practical value, but that meaning of the operator differs from its meaning when applied to non-Boolean values (the general case, and the one I had in mind when I argued that it was a bad idea). >> I find data abstraction to be a Good Thing, and have produced >> much better code since defining a Boolean data type and using >> it in a strictly type-correct manner. > > This fact doesn't bother people who write in APL, widely considered > to be the most mathematical language. APL doesn't offer real facilities for data abstraction. > Why does it bother you? Because as a conscientious software engineer I have to produce reliable and maintainable systems for people to use. This requires quality standards well beyond what hackers might feel to be necessary.