On Sunday, October 2, 2016 at 12:24:24 PM UTC+8, Ian Lance Taylor wrote: > > On Sat, Oct 1, 2016 at 9:21 PM, T L <tapi...@gmail.com <javascript:>> > wrote: > > > > On Sunday, October 2, 2016 at 12:17:05 PM UTC+8, Ian Lance Taylor wrote: > >> > >> On Sat, Oct 1, 2016 at 10:56 AM, T L <tapi...@gmail.com> wrote: > >> > > >> > On Sunday, October 2, 2016 at 12:38:00 AM UTC+8, Ian Lance Taylor > wrote: > >> >> > >> >> On Sat, Oct 1, 2016 at 8:55 AM, T L <tapi...@gmail.com> wrote: > >> >> > > >> >> > On Saturday, October 1, 2016 at 11:29:35 PM UTC+8, Axel Wagner > wrote: > >> >> >> > >> >> >> It *is* possible to define two named types with the same name > (which > >> >> >> are > >> >> >> not identical according to the spec): > >> >> >> https://play.golang.org/p/PmkcvdNQnx > >> >> > > >> >> > > >> >> > Oh, never know we can define local types! > >> >> > > >> >> > But, from my understanding, according to the spec, the two local X > >> >> > types > >> >> > are > >> >> > identical. > >> >> > But the compiler doesn't think so. > >> >> > A compiler bug? > >> >> > >> >> I'm sorry, I don't follow your argument. The spec says, as you've > >> >> already quoted, "Two named types are identical if their type names > >> >> originate in the same TypeSpec." In the playground example above, > the > >> >> two types named "X" do not originate in the same TypeSpec, so they > are > >> >> not identical. > >> > > >> > Then could you provide an example two identical custom named types > >> > originate > >> > in the same TypeSpec? > >> > >> I don't know what it means to have two identical custom named types. > >> When type T1 and type T2 are identical, they are the same type. When > >> they are identical named types, they have the same name, so we are > >> talking about types T and T. The question is: when is type T > >> identical to type T? The answer is: when both instances of T > >> originate in the same TypeSpec. And that answer makes sense, because > >> as we saw above it is entirely possible to have two types named T that > >> do not originate in the same TypeSpec, and those types are not > >> identical. > > > > > > Copied from this issue thread, > https://github.com/golang/go/issues/17310 > > > > My English is really not good,..., I think the text "originate in the > same > > TypeSpec" should be changed to "originate in same one TypeSpec" > > I'm sorry, in my opinion that would not be good English. > > Ian >
;D ok, my current understanding is, the whole meaningfulness of this line in go spec Two named types <https://golang.org/ref/spec#Types> are identical if their type names originate in the same TypeSpec <https://golang.org/ref/spec#Type_declarations>. is to explain in the following code type T0 AnotherType T0 and T0 are identical. -- 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.