On Friday, October 21, 2016 at 11:20:44 PM UTC+8, Alan Donovan wrote:
>
> On 21 October 2016 at 11:15, T L <tapi...@gmail.com <javascript:>> wrote:
>>
>> On Friday, October 21, 2016 at 10:01:43 PM UTC+8, Ian Lance Taylor wrote:
>>>
>>> On Fri, Oct 21, 2016 at 6:52 AM, Henrik Johansson <dahan...@gmail.com> 
>>> wrote: 
>>> > The confusion I have had is rather with nilability. 
>>> > A channel can be nil even though it is not explicitly a pointer. 
>>>
>>> It's a basic design decision in Go that every type has a zero value. 
>>> For the "reference types" (pointer, channel, map, slice, interface) 
>>> that zero value is named "nil". 
>>>
>>
>> I have a question, should the following type be called reference type?
>>
>> type T struct {
>> p *int
>> }
>>
>
> By the definition I gave, yes, because an instance of T contains a 
> reference to an int variable.  All copies of a given T value share the same 
> int variable, and a change to that variable by any one will be observed by 
> all the others.
>

I have never seen an official definition for "reference type". My 
understanding is "reference type is a pointer type or a pointer wrapper 
type", right?
 

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