Again, if you really understand the datastructure and what it represents, the behaviour is really not surprising. There is no value "abstraction".
And currently, a comparison panics. Any interface comparison may panic if the underlying type is a slice. I don't see a good reason for that. That's why I have mentioned "relaxing". I also don't see why someone would need to import unsafe for this, leaving alone the fact that some hosting solutions may not allow the import of this package. On Friday, July 1, 2016 at 3:39:12 AM UTC+2, kortschak wrote: > > On Thu, 2016-06-30 at 18:15 -0700, Chad wrote: > > No, it's actually fine. You are comparing values. > > The issue is that, yes while everything is a value, the value > abstraction is tenuous in this context. The result of this tenuous > abstraction is that there would be surprising behaviours (already > outlined by others). > > > A slice being a struct under the hood, for slices you would compare > > the structs (slice headers) > > > > For an interface, you compare two pointers (in the current > > implementation) > > > > etc. > > > > "==" is just value comparison everywhere. > > > > Everything is a value. > > Some of the values are not specified in the language specification. > Making this equality comparison possible for all types would require > that these be specified, locking in the current implementation. > > This would be to get behaviour that is already available either by > indirection or import of unsafe. > > -- 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.