On Monday, October 15, 2018 at 11:32:23 PM UTC-4, Eric Raymond wrote:
>
> Fair enough.  I am completely willing to discard the possibility of 
> overloading && and ||
>

A little thought showed me that this is not required.

The straightforward way to write the contract of "!" would be that it is a 
monadic function of any type returning true if the operand is the zero 
value of that type and false otherwise.  It follows that for types with 
"implements !" the expression a && b expands to this:

if !!a {return !!a} else {return !!b}

If we want to be more Pythonic and remove the requirement that it return 
bool

if !!a {return a} else {return b}

provided a and b are the same type.

-- 
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