Just so. One cannot do boolean arithmetic with boolean variables. We have: EQUIVALENCE ("==") XOR ("!=") NOT ("!") -- George Boole's NEGATION
We lack: AND ("&") -- George Boole's CONJUNCTION OR ("|") -- George Boole's DISJUNCTION As it happens, one can implement all the operators from the basis of NEGATION and either CONJUNCTION or DISJUNCTION, but as we lack each of the last two, one must be sure to use ints where bools would be natural. Obviously Go users have gotten along fine without the two missing operations so there may be little argument for it. (Also, with the bool type as Go's platypus there is an aura of acceptable inconsistency anyway--since we can't take addresses of them* then it could be argued that other differences are ok as well.) On the pro side, Rob did once mention openness to including them. Michael * Understand the reason...allowing future implementation of packed boolean arrays. On Fri, May 5, 2017 at 5:35 AM, Ian Lance Taylor <i...@golang.org> wrote: > On Fri, May 5, 2017 at 12:51 AM, roger peppe <rogpe...@gmail.com> wrote: > > On 4 May 2017 at 20:48, Michael Jones <michael.jo...@gmail.com> wrote: > >> What is *actually* missing is boolean operators for boolean types. > > > > Really? We've got !, &&, ||, != (xor), == (xnor). What's missing? > > In a sense we are missing & and |, the non-shortcut versions of && and ||. > > Ian > > >> On Thu, May 4, 2017 at 12:43 PM, Ian Lance Taylor <i...@golang.org> > wrote: > >>> > >>> On Thu, May 4, 2017 at 9:42 AM, <occi...@esperanto.org> wrote: > >>> > > >>> > One apparently random omission in C, which was fixed in Perl, is &&= > and > >>> > ||=: > >>> > > >>> > a &&= b > >>> > a = a && b > >>> > a ||= b > >>> > a = a || b > >>> > > >>> > except that a gets evalutated only once (e.g. myarray[f(2)] &&= b) > >>> > > >>> > Besides being useful, this would make Go more consistent. Of course > >>> > relative operators also do not have this, but there usually the > result > >>> > type > >>> > is different (e.g. bool = int < int) > >>> > >>> The &&= and ||= operators are omitted in both C and Go because they > >>> are short-cutting operators. When you write `a = a && b`, then if a > >>> is true, b is not evaluated. So presumably when you write `a &&= b` > >>> then if a is true b is not evaluated. But it is potentially confusing > >>> to see `a &&= f()` when f() may or may not be called. > >>> > >>> Ian > >>> > >>> -- > >>> You received this message because you are subscribed to the Google > Groups > >>> "golang-nuts" group. > >>> To unsubscribe from this group and stop receiving emails from it, send > an > >>> email to golang-nuts+unsubscr...@googlegroups.com. > >>> For more options, visit https://groups.google.com/d/optout. > >> > >> > >> > >> > >> -- > >> Michael T. Jones > >> michael.jo...@gmail.com > >> > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "golang-nuts" group. > >> To unsubscribe from this group and stop receiving emails from it, send > an > >> email to golang-nuts+unsubscr...@googlegroups.com. > >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Michael T. Jones michael.jo...@gmail.com -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.