2016-06-30 22:23 GMT+02:00 Chad <send2b...@gmail.com>: >> Your proposition merely moves the semantical constraint to another >> place: as Ian pointed out, if we define equality for slices to be >> something resembling pointer equality suddenly []byte{1, 2} is not equal >> to []byte{1, 2}. > > > They are not since creating a slice allocate a different underlying array > each time. They are not views on the same array. > It is merely incidental that on the example that is given, the two arrays > have the same first and second elements.
This may seem entirely obvious to you, but explaining to a newcomer why fmt.Println(1 == 1) // => true fmt.Println("2" == "2") // => true fmt.Println([...]int{1, 2} == [...]int{1, 2}) // => true fmt.Println([]int{1, 2} == []int{1, 2}) // => false is not something I feel would make the language better. //jb -- 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.