A pointer to an array is useful. A pointer to a slice is much less so; in
fact, it's often a mistake. The slice already contains a pointer to the
data (in fact, as a pointer to an array!). Best not to promote the bad idea.

-rob


On Sun, Dec 4, 2016 at 11:27 AM, Patrick Smith <pat42sm...@gmail.com> wrote:

> The spec says:
>
> "A primary expression of the form
>
> a[x]
>
> denotes the element of the array, pointer to array, slice, string or map a
> indexed by x."
>
> I am curious about one point - what is the reason for allowing a to be a
> pointer to array, but not allowing a to be a pointer to slice? In both
> cases, a[x] would be equivalent to (*a)[x].
>
> --
> 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.
>

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