On Thursday, October 20, 2016 at 4:46:52 PM UTC+8, Dave Cheney wrote: > > What is a pointer wrapper value? >
struct { p *T } > > in all seriousness, if you review the git history of the Go spec you'll > find the word "reference" was purged about two years ago, in effect, to try > to stem these discussions. > Yes, I found many old docs and old web pages are still using the word "reference value". I think it is an unnecessary word. The concepts of values and pointer values are sufficient to understand Golang values well. > > On Thursday, 20 October 2016 16:07:07 UTC+9, T L wrote: >> >> >> >> On Thursday, October 20, 2016 at 12:44:26 AM UTC+8, adon...@google.com >> wrote: >>> >>> On Wednesday, 19 October 2016 06:33:09 UTC-4, Jan Mercl wrote: >>>> >>>> On Wed, Oct 19, 2016 at 12:27 PM T L <tapi...@gmail.com> wrote: >>>> >>>> Nothing. The language specification does not mention it. >>>> >>>> People use that term based on definitions specified for other >>>> programming languages, but those are not always equal to each other. >>>> >>> >>> Jan is write that the term does not appear in the spec, but I think it's >>> possible to come up with a useful definition of a reference type that >>> applies to all ALGOL-like languages: a reference type is one whose values >>> indirectly refer to mutable state. So, pointers are obviously references, >>> as are slices, maps, and channels. But a string is not a reference >>> because, although internally it contains a pointer, you cannot mutate the >>> array of bytes to which it refers. Functions may be references, because a >>> closure may refer to lexically enclosing variables. Structs and arrays are >>> references if their elements contain references. An interface value is a >>> reference if its payload contains a references. >>> >>> The essence of a reference is that copying one creates a new alias for >>> its underlying state, and changes made via one alias are visible to all >>> others. This definition is not absolute: a pointer to an immutable data >>> structure, for example, can be considered to have "value" (non-reference) >>> semantics since although it points to a variable, that variable can never >>> be changed. >>> >>> >> So reference values must be pointer related? Reference values can be >> direct pointer values or pointer wrapper values, people can modify the >> values pointed by the pointers directly or indirectly (through the methods >> or other mechanisms exposed on the reference value identifier)? >> > -- 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.