On Wed, Jun 29, 2016 at 11:19 AM, Chad <send2b...@gmail.com> 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.

The problem is that different programs need different things for slice
equality.  Some want pointer equality as you suggest.  Some want
element comparisons, as is done for array equality.  Without an
obvious semantics for the operation, the language omits it entirely.

To store slices in maps using pointer equality, you could perhaps
store a pointer to the slice instead.

Ian

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