On Monday, 13 March 2017 21:14:27 UTC, Dave Cheney wrote:
>
> A few clarifications, b does not point to a. a and b are variables of type 
> []int. The value of each slice's ptr fields point to a backing array of 
> some capacity. 
>
> If you append to a, this does not change th length or cap fields of b. If 
> you do this enough times that ptr field of a will be updated to reflect 
> that it now points to a different backing array. 
>
> Perhaps something like this could be used to determine if a and b point to 
> th same backing array, but as you suggested, it's probably the wrong 
> question.
>
> https://play.golang.org/p/kS4iysimIV
>

Yes . except the last part - I think that pointer check is effectively a 
check for equivalence

eg this modification - shows how that can fail

https://play.golang.org/p/lb--CNeERd

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