I would take it to mean

c := make(elementof(a), len(a)+len(b))
copy(c, a)
copy(c[len(a):], b)

which is subtly different from append(a, b...). And when you don't care
about the difference, it would be less efficient. For strings, on the other
hand, it can only mean one of the two (as strings are immutable, there is
no append).

So even if you discount the elementwise add, it would still be ambiguous.

On Fri, Sep 16, 2016 at 7:33 PM, Ian Lance Taylor <i...@golang.org> wrote:

> On Fri, Sep 16, 2016 at 9:02 AM,  <oyi...@gmail.com> wrote:
> > I have not been able to find an explanation. Does anyone care to explain
> or
> > point to relevant documentation?
>
> Slices are not strings.  I think that a + b has an intuitively clear
> value when a and b are strings.  I do not think it does when a and b
> are slices.  You would presumably suggest that it means the same as
> append(a, b...) but I think it could also mean
>     c := make(elementof(a), len(a))
>     for i, v := range a {
>         c[i] = v + b[i]
>     }
>
> Given the lack of clear meaning for addition of slices, the language
> omits it.  Instead, it provides append and loops.
>
> 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.
>

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