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
On Sat, Oct 1, 2016 at 5:03 PM, Jan Mercl <0xj...@gmail.com> wrote: > On Sat, Oct 1, 2016 at 4:28 PM T L <tapir....@gmail.com> wrote: > > > I know this byte and uint8 are identical in syntax. > > They are identical semantically. > > > But they are not defined with TypeSpec > <https://golang.org/ref/spec#Type_declarations> style described in the go > spec. > > It's not possible to define all predeclared Go types using Go syntax. The > predeclared error type can be defined just normally, for example[0]. But > there's no way how to define a byte using valid Go source code. Some basic > building blocks must be predefined in every sane programming language. From > those basic building blocks other types can be built in source, provided > the language supports user defined types at all. > > > In addition to there is no ways to define identical custom named types, > so I think the text "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>." in go spec is > meaningless. > > It's been discussed earlier in this thread that without this "meaningless" > specification detail a particular example program would be rejected. It is > not, because of this specs sentence. How it could be meaningless then? > > > Sorry, my English is not good, I have tried my best to explain my > opinion. > > No problem with your English ;-) > > [0]: https://github.com/cznic/gc/blob/c3bc1381b6d1fb6498e2ef9f76002f > c09554b3f8/context.go#L59 > > -- > > -j > > -- > 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. > -- 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.