On Monday, October 15, 2018 at 11:02:18 PM UTC-4, Ian Denhardt wrote: > > > There are other operators in the language that don't behave like > functions or methods (e.g. boolean operators like && and ||, which > short-circut), but the rest of them are things that don't have gobs of > use cases for overriding anyway, so it's easy to just say "you can't > override those." I don't think we can credibly call operator overloading > a solution if you can't abstract over ==. >
Fair enough. I am completely willing to discard the possibility of overloading && and || and almost any other operator that doesn't behave like a function, because I think we get a rich enough set of contracts from those that do. As I implied in my proposal, I think what people really want from contacts is relationals and some operator algebra. But your objection about pointer types is sound. And there is a simple solution to it. That is to forbid "implements" methods on pointer types at compile time. I can't think of a use case for such overloads that isn't overly clever to the point of crazy. I am more than willing to chop that off to preserve the simplicity and transparency of the cases where "implements" is legal. -- 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.