Well, I agree! :) Comparisons should be shallow where possible for every type, including slices and maps. That's my initial argument.
On Tue, May 3, 2022 at 11:22 PM Jan Mercl <0xj...@gmail.com> wrote: > On Wed, May 4, 2022 at 12:15 AM Will Faught <will.fau...@gmail.com> wrote: > > > I'm not sure we're on the same page in terminology. I meant shallow as > opposed to deep. E.g. pointer equality in terms of `==` vs. > `reflect.DeepEqual`. Unequal pointers can reference values that are > equivalent. > > I think we are on the same page. This thread is about comparisons on > the language level, not about some library functions. Thus we can > ignore reflect.DeepEqual and focus on the equality operator only. That > makes things simpler. > > Now, what I wanted to point out is that the equality operator, as > defined in Go, always compares the values of its operands. It's a > simple and easy to remember rule. It could have been defined in a > different way, sure. Anyway, it was not and talking about deep vs > shallow comparison of the Go equality operator does not make the > discussion any clearer - because it does not, in our case, apply. > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAKbcuKjr2AKu07hWfPxZLoKoNO5EMbZb8HGgRMOHULDh6Yd5iQ%40mail.gmail.com.