On Fri, Jul 1, 2016 at 12:52 PM, Chad <send2b...@gmail.com> wrote: > However, that it's a valid point you raise (re strings) > But that's exactly the reason for which, someone would probably ask whether > a string is a reference type or a value type. > > This could probably made clearer in the documentation.
I keep seeing references (hah!) to this concept of a "reference type" :-) However, I just tried searching the language spec and Effective Go and there doesn't seem to be such a concept defined in those documents. Effective Go talks about slices and maps having "references" to some underlying data, but I don't think it says that maps and slices themselves are "reference types". So my understanding is that there is no such concept in Go. Instead there are structs and pointers -- maps and slices are builtin types, implemented as small structs that points to larger pieces of data. When you pass either to a function, you end up copying the struct -- the normal value semantic we all know so well. Copying the struct is fine since they're small: a slice is a pointer and two ints, I'm unsure how a map looks like but I hope it's similarly sized. I'm very new to Go, so please let me know if I'm missing anything? -- Martin Geisler -- 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.