|
|
|
|
|
by TheDong
631 days ago
|
|
Any "comparable" struct, which is to say any struct where '==' works. No, you can't override '=='. This will not work for the average struct, and if you do use it, you now no longer can include any, for example `[]byte` fields in the struct or else it will no longer compile. I always find it funny that `string` is comparable, but `[]rune` and `[]byte` are not. |
|
For slice types it's more complex because there is mutability implicit aliasing. And the backing array pointed at may change. I guess the latter should point us toward deep value comparison for slice types since any other comparison would be quite flimsy.