On Tuesday, August 23, 2016 at 9:09:34 PM UTC+8, Ian Lance Taylor wrote:
>
> On Mon, Aug 22, 2016 at 10:37 PM, T L <tapi...@gmail.com <javascript:>> 
> wrote: 
> > 
> > On Tuesday, August 23, 2016 at 1:28:03 PM UTC+8, T L wrote: 
> >> 
> >> Looks this question can be stated as "why can't named pointer types 
> have 
> >> methods?" 
> > 
> > 
> > Just found this thread 
> > https://groups.google.com/forum/#!topic/golang-nuts/Vhh5XOm96YI 
> > to answer "why can't named pointer types have methods?" 
> > 
> > But I think the two questions are not totally equivalent: 
> > 1. Why a **T value can't call methods of *T? 
> > 2. Why can't named pointer types have methods? 
>
> Your second question has been answered. 
>
> The first question is, essentially, what is the method set of **T? 
> The answer is: **T has no methods.  Why should it? 
>
> T has methods (or at least may have methods): the methods whose 
> receiver is type T.  *T has methods: the methods whose receiver is 
> type *T.  For convenience, the methods of T are added to the method 
> set of *T. 
>
> **T does not have methods.  There is no reason to add the methods of 
> *T to the method set of **T, because the method set of **T is empty. 
>

ok, we know golang doesn't lack minor/exception rules.
 

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

Reply via email to