What is *actually* missing is boolean operators for boolean types.

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.

Reply via email to