On Wed, 2016-06-29 at 11:19 -0700, Chad wrote:
> Just been thinking that since a slice is a "reference" type, why not
> allow 
> slice equality?
> Of course the number of cases where two slices are equal would be
> quite 
> low, irrelevant of whether the view they have on their respective
> arrays is 
> the same.
> 
> I'm thinking about something analogous to comparing pointer values.
> No 
> notion of deep equality as can be done via reflect.

*(*uintptr)(unsafe.Pointer(&a)) == *(*uintptr)(unsafe.Pointer(&b)) for
maps

*(*reflect.SliceHeader)(unsafe.Pointer(&a) ==
*(*reflect.SliceHeader)(unsafe.Pointer(&b) for slices.

Neither are wildly useful for most cases (we use the map case for some
fast path comparisons of maps).

-- 
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.

Reply via email to