FAQ
the code:
package builtin
     import "builtin"



FUNCTIONS

func append(slice []Type, elems ...Type) []Type
     The append built-in function appends elements to the end of a slice. If
     it has sufficient capacity, the destination is resliced to accommodate
     the new elements. If it does not, a new underlying array will be
     allocated. Append returns the updated slice. It is therefore necessary
     to store the result of append, often in the variable holding the slice
     itself:

slice = append(slice, elem1, elem2)
slice = append(slice, anotherSlice...)

     As a special case, it is legal to append a string to a byte slice, like
     this:

slice = append([]byte("hello "), "world"...)

*
*
*func append(slice []Type, elems ...Type) []Type the statement of three
Type is same Type, what's the special mean?if i change to
*
*
func append(slice []A, elems ...A) []A ,is't ok?*

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ian Lance Taylor at Oct 23, 2013 at 3:02 pm

    On Wed, Oct 23, 2013 at 7:41 AM, you fu wrote:
    func append(slice []Type, elems ...Type) []Type the statement of three Type
    is same Type, what's the special mean?if i change to

    func append(slice []A, elems ...A) []A ,is't ok?
    As the package documentation states:

        "Type is here for the purposes of documentation only. It is a
         stand-in for any Go type, but represents the same type for any
         given function invocation."

    http://golang.org/pkg/builtin/#Type

    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedOct 23, '13 at 2:41p
activeOct 23, '13 at 3:02p
posts2
users2
websitegolang.org

2 users in discussion

Ian Lance Taylor: 1 post You fu: 1 post

People

Translate

site design / logo © 2022 Grokbase