> > The problem is that different programs need different things for slice > equality. Some want pointer equality as you suggest. Some want > element comparisons, as is done for array equality. Without an > obvious semantics for the operation, the language omits it entirely. >
That's true. However, the flipside of the coin is that perfectly marshallable objects cannot be used as map keys because at least one field is a slice, map or function. That restricts the usage of maps sometimes unnecessarily. If the equality operator were to have the same semantic everywhere (mere value comparison, whether for a pointer, map/slice/func or an array), it would solve the issue. The spec would not even have to rely on the internal structure of a slice, map or function. -- 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.